From 2c1173aadfe1272c27412da9056d8f1fa1f88ce0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 13 Feb 2002 17:52:53 +0000 Subject: [PATCH] totally zap a client slot when the server sends an svc_updateuserinfo with a blank info string as the only way this should ever happen is when the server is dropping the relevant client so our client might as well drop it too. --- qw/source/cl_parse.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index ddaa74299..ccb9a0be8 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -976,8 +976,10 @@ CL_ProcessUserInfo (int slot, player_info_t *player) void CL_UpdateUserinfo (void) { - int slot; + int slot; player_info_t *player; + int uid; + const char *info; slot = MSG_ReadByte (net_message); if (slot >= MAX_CLIENTS) @@ -985,13 +987,19 @@ CL_UpdateUserinfo (void) ("CL_ParseServerMessage: svc_updateuserinfo > MAX_SCOREBOARD"); player = &cl.players[slot]; - player->userid = MSG_ReadLong (net_message); if (player->userinfo) Info_Destroy (player->userinfo); - player->userinfo = Info_ParseString (MSG_ReadString (net_message), - MAX_INFO_STRING); - - CL_ProcessUserInfo (slot, player); + uid = MSG_ReadLong (net_message); + info = MSG_ReadString (net_message); + if (*info) { + // a totally empty userinfo string should not be possible + player->userid = uid; + player->userinfo = Info_ParseString (info, MAX_INFO_STRING); + CL_ProcessUserInfo (slot, player); + } else { + // the server dropped the client + memset (player, 0, sizeof (*player)); + } } void