diff options
-rw-r--r-- | src/network/network_client.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index b4d0a06f7..0cb7728e6 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -125,6 +125,7 @@ struct PacketReader : LoadFilter { void ClientNetworkEmergencySave() { if (!_settings_client.gui.autosave_on_network_disconnect) return; + if (!_networking) return; const char *filename = "netsave.sav"; DEBUG(net, 0, "Client: Performing emergency save (%s)", filename); @@ -212,6 +213,8 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res) SendError(errorno); } + ClientNetworkEmergencySave(); + _switch_mode = SM_MENU; this->CloseConnection(res); _networking = false; @@ -1173,7 +1176,6 @@ void ClientNetworkGameSocketHandler::CheckConnection() if (lag > 20) { this->NetworkGameSocketHandler::CloseConnection(); ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL); - ClientNetworkEmergencySave(); return; } |