From 71b34cba76442935fbe8b1a1db334da8715f5ceb Mon Sep 17 00:00:00 2001 From: eihrul Date: Thu, 1 Dec 2011 19:39:23 +0000 Subject: [PATCH] check for valid socket in Con_Rcon_Redirect_Flush git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11586 d7cf8633-e32d-0410-b094-e92efae38249 --- console.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/console.c b/console.c index 14175b07..831c30a9 100644 --- a/console.c +++ b/console.c @@ -905,13 +905,16 @@ void Con_Rcon_Redirect_Init(lhnetsocket_t *sock, lhnetaddress_t *dest, qboolean static void Con_Rcon_Redirect_Flush(void) { - rcon_redirect_buffer[rcon_redirect_bufferpos] = 0; - if (rcon_redirect_proquakeprotocol) + if(rcon_redirect_sock) { - // update the length in the packet header - StoreBigLong((unsigned char *)rcon_redirect_buffer, NETFLAG_CTL | (rcon_redirect_bufferpos & NETFLAG_LENGTH_MASK)); + rcon_redirect_buffer[rcon_redirect_bufferpos] = 0; + if (rcon_redirect_proquakeprotocol) + { + // update the length in the packet header + StoreBigLong((unsigned char *)rcon_redirect_buffer, NETFLAG_CTL | (rcon_redirect_bufferpos & NETFLAG_LENGTH_MASK)); + } + NetConn_Write(rcon_redirect_sock, rcon_redirect_buffer, rcon_redirect_bufferpos, rcon_redirect_dest); } - NetConn_Write(rcon_redirect_sock, rcon_redirect_buffer, rcon_redirect_bufferpos, rcon_redirect_dest); memcpy(rcon_redirect_buffer, "\377\377\377\377n", 5); // QW rcon print rcon_redirect_bufferpos = 5; rcon_redirect_proquakeprotocol = false; -- 2.39.2