Fixed a very rare bug where games and folders could get mixed up during gamelist.xml parsing.

This commit is contained in:
Leon Styhre 2022-05-21 14:25:44 +02:00
parent 990eb84707
commit c66d2ace27

View file

@ -190,6 +190,15 @@ namespace GamelistFileParser
} }
FileData* file = findOrCreateFile(system, path, type); FileData* file = findOrCreateFile(system, path, type);
// Don't load entries with the wrong type. This should very rarely (if ever) happen.
if (file != nullptr && ((tag == "game" && file->getType() == FOLDER) ||
(tag == "folder" && file->getType() == GAME))) {
LOG(LogWarning)
<< "Game/folder mismatch for \"" << path << "\", skipping entry";
continue;
}
if (!file) { if (!file) {
LOG(LogError) << "Couldn't find or create \"" << path << "\", skipping entry"; LOG(LogError) << "Couldn't find or create \"" << path << "\", skipping entry";
continue; continue;