changeset 13039:88927f4bc92e draft

(svn r17537) -Fix: don't crash while printing gamelog in crash handler if we crashed before while gamelog action was active
author smatz <smatz@openttd.org>
date Mon, 14 Sep 2009 19:30:13 +0000
parents 7b40620b49a4
children dcdd380e5ac3
files src/crashlog.cpp src/gamelog.cpp
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/crashlog.cpp
+++ b/src/crashlog.cpp
@@ -211,9 +211,7 @@
 	if (_m == NULL) return false;
 
 	try {
-		GamelogStartAction(GLAT_EMERGENCY);
 		GamelogEmergency();
-		GamelogStopAction();
 
 		seprintf(filename, filename_last, "%scrash.sav", _personal_dir);
 
--- a/src/gamelog.cpp
+++ b/src/gamelog.cpp
@@ -334,8 +334,11 @@
  */
 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.