1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +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:
Ivan Savenko
2024-12-23 18:00:35 +00:00
parent 2272707175
commit 8c6208be04
6 changed files with 50 additions and 13 deletions

View File

@@ -445,7 +445,14 @@ void ApplyOnServerNetPackVisitor::visitLobbyDelete(LobbyDelete & pack)
if(pack.type == LobbyDelete::EType::SAVEGAME || pack.type == LobbyDelete::EType::RANDOMMAP)
{
auto res = ResourcePath(pack.name, pack.type == LobbyDelete::EType::SAVEGAME ? EResType::SAVEGAME : EResType::MAP);
auto file = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(res));
auto name = CResourceHandler::get()->getResourceName(res);
if (!name)
{
logGlobal->error("Failed to find resource with name '%s'", res.getOriginalName());
return;
}
auto file = boost::filesystem::canonical(*name);
boost::filesystem::remove(file);
if(boost::filesystem::is_empty(file.parent_path()))
boost::filesystem::remove(file.parent_path());
@@ -453,7 +460,13 @@ void ApplyOnServerNetPackVisitor::visitLobbyDelete(LobbyDelete & pack)
else if(pack.type == LobbyDelete::EType::SAVEGAME_FOLDER)
{
auto res = ResourcePath("Saves/" + pack.name, EResType::DIRECTORY);
auto folder = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(res));
auto name = CResourceHandler::get()->getResourceName(res);
if (!name)
{
logGlobal->error("Failed to find folder with name '%s'", res.getOriginalName());
return;
}
auto folder = boost::filesystem::canonical(*name);
boost::filesystem::remove_all(folder);
}