(svn r17537) -Fix: don't crash while printing gamelog in crash handler if we crashed before while gamelog action was active

This commit is contained in:
smatz 2009-09-14 19:30:13 +00:00
parent 8deb7efcc7
commit d6f4cda74e
2 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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.