# HG changeset patch # User smatz # Date 2009-09-14 19:30:13 # Node ID d6cdd1e2b288f6a0ddc75c1ed24a6150193dcc10 # Parent de35c4dd904c2b8bd0d94b6d2fe0263416e3f466 (svn r17537) -Fix: don't crash while printing gamelog in crash handler if we crashed before while gamelog action was active diff --git a/src/crashlog.cpp b/src/crashlog.cpp --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -211,9 +211,7 @@ bool CrashLog::WriteSavegame(char *filen 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 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -334,8 +334,11 @@ static LoggedChange *GamelogChange(Gamel */ 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.