Fix #4755: Crash loading new map while running a server

This commit is contained in:
Michał Janiszewski 2016-11-11 18:27:40 +01:00
parent 0496cf6bd8
commit 0793b3bc11
1 changed files with 7 additions and 1 deletions

View File

@ -927,7 +927,13 @@ void Network::Server_Send_MAP(NetworkConnection* connection)
SDL_RWops* rw = SDL_RWFromFP(temp, SDL_TRUE);
size_t out_size;
unsigned char *header;
header = save_for_network(rw, out_size, connection->RequestedObjects);
std::vector<const ObjectRepositoryItem *> objects;
if (connection) {
objects = connection->RequestedObjects;
} else {
objects = scenario_get_packable_objects();
}
header = save_for_network(rw, out_size, objects);
SDL_RWclose(rw);
if (header == nullptr) {
connection->SetLastDisconnectReason(STR_MULTIPLAYER_CONNECTION_CLOSED);