From d6f4cda74e7f10160ec28b965dc605cf914f3444 Mon Sep 17 00:00:00 2001 From: smatz Date: Mon, 14 Sep 2009 19:30:13 +0000 Subject: [PATCH] (svn r17537) -Fix: don't crash while printing gamelog in crash handler if we crashed before while gamelog action was active --- src/crashlog.cpp | 2 -- src/gamelog.cpp | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/crashlog.cpp b/src/crashlog.cpp index af2bd69fd6..2a46866d1d 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -211,9 +211,7 @@ bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const if (_m == NULL) return false; try { - GamelogStartAction(GLAT_EMERGENCY); GamelogEmergency(); - GamelogStopAction(); seprintf(filename, filename_last, "%scrash.sav", _personal_dir); diff --git a/src/gamelog.cpp b/src/gamelog.cpp index d988955263..ed6cdfa8cb 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -334,8 +334,11 @@ static LoggedChange *GamelogChange(GamelogChangeType ct) */ void GamelogEmergency() { - assert(_gamelog_action_type == GLAT_EMERGENCY); + /* Terminate any active action */ + if (_gamelog_action_type != GLAT_NONE) GamelogStopAction(); + GamelogStartAction(GLAT_EMERGENCY); GamelogChange(GLCT_EMERGENCY); + GamelogStopAction(); } /** Finds out if current game is a loaded emergency savegame.