From 5d69eda3da46e78a000bfcfbf1ff9e9a28a81760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C4=8Cern=C3=A1=C4=8D?= Date: Tue, 2 Feb 2016 11:08:42 +0100 Subject: [PATCH] Fix segfault when loading network game with unknown objects This oneliner causes the game not to crash, when connecting to a network game that utilizes objects, that the connecting client doesn't have installed. Instead, it quits to the main menu with an error message being displayed. --- src/network/network.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/network.cpp b/src/network/network.cpp index fbf1fb9972..66f338a3f9 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1716,6 +1716,12 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa // window_network_status_open("Loaded new map from network"); _desynchronised = false; } + else + { + //Something went wrong, game is not loaded. Return to main screen. + game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0); + } + SDL_RWclose(rw); if (has_to_free) {