mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed crash bug when connecting/disconnecting
This commit is contained in:
parent
977785b154
commit
a6be56dbdc
|
@ -234,7 +234,7 @@ enum
|
|||
SNAPSTORAGE snapshot_storage;
|
||||
static SNAPSTORAGE_HOLDER *snapshots[NUM_SNAPSHOT_TYPES];
|
||||
|
||||
static int recived_snapshots;
|
||||
static int recived_snapshots = 0;
|
||||
static char snapshot_incomming_data[MAX_SNAPSHOT_SIZE];
|
||||
|
||||
static SNAPSTORAGE_HOLDER demorec_snapshotholders[NUM_SNAPSHOT_TYPES];
|
||||
|
@ -561,6 +561,11 @@ void client_disconnect_with_reason(const char *reason)
|
|||
|
||||
/* clear the current server info */
|
||||
mem_zero(¤t_server_info, sizeof(current_server_info));
|
||||
|
||||
/* clear snapshots */
|
||||
snapshots[SNAP_CURRENT] = 0;
|
||||
snapshots[SNAP_PREV] = 0;
|
||||
recived_snapshots = 0;
|
||||
}
|
||||
|
||||
void client_disconnect()
|
||||
|
@ -989,6 +994,10 @@ static void client_process_packet(NETCHUNK *packet)
|
|||
int complete_size = 0;
|
||||
const char *data = 0;
|
||||
|
||||
/* we are not allowed to process snapshot yet */
|
||||
if(client_state() < CLIENTSTATE_LOADING)
|
||||
return;
|
||||
|
||||
if(msg == NETMSG_SNAP)
|
||||
{
|
||||
num_parts = msg_unpack_int();
|
||||
|
|
Loading…
Reference in a new issue