summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-09-14 19:30:13 +0000
committersmatz <smatz@openttd.org>2009-09-14 19:30:13 +0000
commitd6f4cda74e7f10160ec28b965dc605cf914f3444 (patch)
tree250dbe20b12a5be3dd680664fdea78ff8b3c9e54 /src
parent8deb7efcc763508d69ed5c1de2a415901373050f (diff)
downloadopenttd-d6f4cda74e7f10160ec28b965dc605cf914f3444.tar.xz
(svn r17537) -Fix: don't crash while printing gamelog in crash handler if we crashed before while gamelog action was active
Diffstat (limited to 'src')
-rw-r--r--src/crashlog.cpp2
-rw-r--r--src/gamelog.cpp5
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.