diff --git a/src/level/player_profile.cpp b/src/level/player_profile.cpp index 9abd20a8..dbe28e2c 100644 --- a/src/level/player_profile.cpp +++ b/src/level/player_profile.cpp @@ -478,13 +478,20 @@ std::vector CPlayerProfile::GetSavedSceneList() for (auto dir : saveDirs) { std::string savegameFile = GetSaveFile(dir+"/data.sav"); - if (CResourceManager::Exists(savegameFile)) + if (CResourceManager::Exists(savegameFile) && CResourceManager::GetFileSize(savegameFile) > 0) { CLevelParser levelParser(savegameFile); levelParser.Load(); CLevelParserLine* line = levelParser.GetIfDefined("Created"); int time = line != nullptr ? line->GetParam("date")->AsInt() : 0; - sortedSaveDirs[time] = SavedScene(GetSaveFile(dir), levelParser.Get("Title")->GetParam("text")->AsString()); + try + { + sortedSaveDirs[time] = SavedScene(GetSaveFile(dir), levelParser.Get("Title")->GetParam("text")->AsString()); + } + catch (CLevelParserException &e) + { + GetLogger()->Error("Error trying to load savegame title: %s\n", e.what()); + } } } diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 4aeb6937..3f6128f2 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -4738,7 +4738,7 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s } catch (CLevelParserException& e) { - GetLogger()->Error("Failed to save level state - %s\n", e.what()); + GetLogger()->Error("Failed to save level state - %s\n", e.what()); // TODO add visual error to notify user that save failed return false; }