]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
check for valid socket in Con_Rcon_Redirect_Flush
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Dec 2011 19:39:23 +0000 (19:39 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 3 Dec 2011 08:53:50 +0000 (09:53 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11586 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=71b34cba76442935fbe8b1a1db334da8715f5ceb

console.c

index 14175b07ad4c37cd84ea4e0202c438c43365c098..831c30a9f35a8dbfdff36f1e52ad53590e74ef25 100644 (file)
--- 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;