mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-25 00:37:24 +02:00
Fixes for crashes discovered via Google Play
- Fix crash on attempt to enable mod with recursive dependencies - Fix crash on attempt to enable Chronicles after failed install - Fixed crash on attempt to access non-installed mod when repository checkout is off - Show error message on failure to load filesystem instead of crash in launcher - Added workaround for crash on attempt to delete nonexisting save/map - Added logging of mod settings to log file to simplify debugging
This commit is contained in:
@ -175,6 +175,8 @@ ModsPresetState::ModsPresetState()
|
||||
auto allPresets = getAllPresets();
|
||||
if (!vstd::contains(allPresets, modConfig["activePreset"].String()))
|
||||
modConfig["activePreset"] = JsonNode(allPresets.front());
|
||||
|
||||
logGlobal->debug("Loading following mod settings: %s", modConfig.toCompactString());
|
||||
}
|
||||
|
||||
void ModsPresetState::createInitialPreset()
|
||||
@ -454,7 +456,14 @@ ModsStorage::ModsStorage(const std::vector<TModID> & modsToLoad, const JsonNode
|
||||
|
||||
const ModDescription & ModsStorage::getMod(const TModID & fullID) const
|
||||
{
|
||||
return mods.at(fullID);
|
||||
try {
|
||||
return mods.at(fullID);
|
||||
}
|
||||
catch (const std::out_of_range & )
|
||||
{
|
||||
// rethrow with better error message
|
||||
throw std::out_of_range("Failed to find mod " + fullID);
|
||||
}
|
||||
}
|
||||
|
||||
TModList ModsStorage::getAllMods() const
|
||||
@ -651,7 +660,7 @@ void ModManager::tryEnableMods(const TModList & modList)
|
||||
|
||||
for (const auto & modName : modList)
|
||||
if (!vstd::contains(testResolver.getActiveMods(), modName))
|
||||
throw std::runtime_error("Failed to enable mod! Mod " + modName + " remains disabled!");
|
||||
logGlobal->error("Failed to enable mod '%s'! This may be caused by a recursive dependency!", modName);
|
||||
|
||||
updatePreset(testResolver);
|
||||
}
|
||||
|
Reference in New Issue
Block a user