mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix possible crash on accessing no longer existing submod
This commit is contained in:
@@ -285,6 +285,13 @@ void ModsPresetState::removeOldMods(const TModList & modsToKeep)
|
|||||||
vstd::erase_if(currentPreset["settings"].Struct(), [&](const auto & entry){
|
vstd::erase_if(currentPreset["settings"].Struct(), [&](const auto & entry){
|
||||||
return !vstd::contains(modsToKeep, entry.first);
|
return !vstd::contains(modsToKeep, entry.first);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (auto & modSettings : currentPreset["settings"].Struct())
|
||||||
|
{
|
||||||
|
vstd::erase_if(modSettings.second.Struct(), [&](const auto & entry){
|
||||||
|
return !vstd::contains(modsToKeep, modSettings.first + "." + entry.first);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModsPresetState::eraseRootMod(const TModID & modName)
|
void ModsPresetState::eraseRootMod(const TModID & modName)
|
||||||
|
|||||||
Reference in New Issue
Block a user