(svn r22064) -Fix [FS#4497] (r21399): crash when disconnecting and reconnecting while the server is still saving the savegame

This commit is contained in:
rubidium
2011-02-11 23:20:35 +00:00
parent 1dc5ba2210
commit d8cada7563
2 changed files with 19 additions and 7 deletions

View File

@@ -2382,13 +2382,20 @@ static SaveOrLoadResult SaveFileToDisk(bool threaded)
} catch (...) {
ClearSaveLoadState();
/* Skip the "colour" character */
DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
AsyncSaveFinishProc asfp = SaveFileDone;
/* We don't want to shout when saving is just
* cancelled due to a client disconnecting. */
if (_sl.error_str != STR_NETWORK_ERROR_LOSTCONNECTION) {
/* Skip the "colour" character */
DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
asfp = SaveFileError;
}
if (threaded) {
SetAsyncSaveFinish(SaveFileError);
SetAsyncSaveFinish(asfp);
} else {
SaveFileError();
asfp();
}
return SL_ERROR;
}