From 80a462abb32a1bf7de154a6abe01db8d517fac33 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 25 Dec 2023 12:06:31 +0100 Subject: [PATCH] Fixed an issue where attempting to create the system directories with invalid entries in es_systems.xml could crash the application --- es-app/src/SystemData.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index c6e3cebf6..2b52757b4 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -1122,6 +1122,18 @@ bool SystemData::createSystemDirectories() return (std::isspace(character) || character == ','); }) != platform.cend()}; + if (name.empty()) { + LOG(LogError) + << "A system in the es_systems.xml file has no name defined, skipping entry"; + continue; + } + else if (fullname.empty() || path.empty() || extensions.empty() || commands.empty()) { + LOG(LogError) << "System \"" << name + << "\" is missing the fullname, path, " + "extension, or command tag, skipping entry"; + continue; + } + themeFolder = system.child("theme").text().as_string(name.c_str()); // Check that the %ROMPATH% variable is actually used for the path element. @@ -1203,7 +1215,10 @@ bool SystemData::createSystemDirectories() } systemInfoFile << "Platform" << (multiplePlatforms ? "s" : "") << " (for scraping):" << std::endl; - systemInfoFile << platform << std::endl << std::endl; + if (platform.empty()) + systemInfoFile << "None defined" << std::endl << std::endl; + else + systemInfoFile << platform << std::endl << std::endl; systemInfoFile << "Theme folder:" << std::endl; systemInfoFile << themeFolder << std::endl; systemInfoFile.close();