Fixed an issue where entering a blank game name in the metadata editor would crash the application.

This commit is contained in:
Leon Styhre 2020-07-26 15:50:40 +02:00
parent 496e653ae7
commit 47523ba627
2 changed files with 10 additions and 1 deletions

View file

@ -46,4 +46,5 @@ v1.0.0
* SystemView didn't properly loop the systems if only two systems were available
* Hidden files still showed up if they had a gamelist.xml entry
* On Unix, adding a hidden folder with a game in it crashed the application on startup
* If the user tried to enter a blank game name in the metadata editor, the application would crash upon saving
* Lots and lots of small bugs and inconsistencies fixed

View file

@ -287,7 +287,15 @@ void GuiMetaDataEd::save()
if (mMetaDataDecl.at(i).isStatistic)
continue;
mMetaData->set(mMetaDataDecl.at(i).key, mEditors.at(i)->getValue());
// If the user has entered a blank game name, then set the name to the ROM
// filename (minus the extension).
if (mMetaDataDecl.at(i).key == "name" && mEditors.at(i)->getValue() == "") {
mMetaData->set(mMetaDataDecl.at(i).key,
Utils::FileSystem::getStem(mScraperParams.game->getPath()));
}
else {
mMetaData->set(mMetaDataDecl.at(i).key, mEditors.at(i)->getValue());
}
}
// Enter game in index.