[colobot] 238/377: Fix startup crash with disabled autosave, closes #705

Didier Raboud odyx at moszumanska.debian.org
Wed Mar 30 13:34:21 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit f3094312b2618bf4f0f321be9e243f557c7679a1
Author: krzys-h <krzys_h at interia.pl>
Date:   Thu Jan 28 20:36:55 2016 +0100

    Fix startup crash with disabled autosave, closes #705
---
 src/level/robotmain.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp
index 53273b5..93d7234 100644
--- a/src/level/robotmain.cpp
+++ b/src/level/robotmain.cpp
@@ -5597,6 +5597,9 @@ int CRobotMain::GetAutosaveSlots()
 
 int CRobotMain::AutosaveRotate(bool freeOne)
 {
+    if (m_playerProfile == nullptr)
+        return 0;
+
     GetLogger()->Debug("Rotate autosaves...\n");
     // Find autosave dirs
     auto saveDirs = CResourceManager::ListDirectories(m_playerProfile->GetSaveDir());
@@ -5606,7 +5609,7 @@ int CRobotMain::AutosaveRotate(bool freeOne)
         try
         {
             const std::string autosavePrefix = "autosave";
-            if (dir.substr(0, autosavePrefix.length()) == "autosave")
+            if (dir.substr(0, autosavePrefix.length()) == autosavePrefix)
             {
                 int id = boost::lexical_cast<int>(dir.substr(autosavePrefix.length()));
                 autosaveDirs[id] = m_playerProfile->GetSaveFile(dir);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list