From 47523ba627691f303309fb7c5d88427e2d7d7eef Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 26 Jul 2020 15:50:40 +0200 Subject: [PATCH] Fixed an issue where entering a blank game name in the metadata editor would crash the application. --- NEWS.md | 1 + es-app/src/guis/GuiMetaDataEd.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a7eddecf4..cd0a3e066 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index 014091583..12c891aa5 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -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.