diff options
author | smatz <smatz@openttd.org> | 2009-09-14 19:30:13 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-09-14 19:30:13 +0000 |
commit | d6f4cda74e7f10160ec28b965dc605cf914f3444 (patch) | |
tree | 250dbe20b12a5be3dd680664fdea78ff8b3c9e54 | |
parent | 8deb7efcc763508d69ed5c1de2a415901373050f (diff) | |
download | openttd-d6f4cda74e7f10160ec28b965dc605cf914f3444.tar.xz |
(svn r17537) -Fix: don't crash while printing gamelog in crash handler if we crashed before while gamelog action was active
-rw-r--r-- | src/crashlog.cpp | 2 | ||||
-rw-r--r-- | src/gamelog.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/crashlog.cpp b/src/crashlog.cpp index af2bd69fd..2a46866d1 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 d98895526..ed6cdfa8c 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. |