Fixed an issue where flagging a game not to be counted could lead to a crash.

This commit is contained in:
Leon Styhre 2020-12-31 19:44:24 +01:00
parent 7992e39b0f
commit 1a4c2fc4ae
2 changed files with 10 additions and 6 deletions

View file

@ -304,7 +304,6 @@ void CollectionSystemsManager::refreshCollectionSystems(FileData* file)
realSys.isEnabled = true;
realSys.isPopulated = true;
realSys.decl.isCustom = false;
updateCollectionSystem(file, realSys);
}
@ -365,6 +364,10 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
}
else if (curSys->isCollection() && !file->getCountAsGame()) {
// If the countasgame flag has been set to false, then remove the game.
if (curSys->isGroupedCustomCollection())
ViewController::get()->getGameListView(curSys->getRootFolder()->getParent()->
getSystem()).get()->remove(collectionEntry, false);
else
ViewController::get()->
getGameListView(curSys).get()->remove(collectionEntry, false);
}

View file

@ -385,7 +385,8 @@ void GuiMetaDataEd::save()
if (mSavedCallback)
mSavedCallback();
// Update respective Collection Entries.
// Update all collections where the game is present.
if (mScraperParams.game->getType() == GAME)
CollectionSystemsManager::get()->refreshCollectionSystems(mScraperParams.game);
mScraperParams.system->onMetaDataSavePoint();