]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/l_net/l_net_berkeley.c
error handling in watchbsp (contributed by ilm)
[xonotic/netradiant.git] / libs / l_net / l_net_berkeley.c
index 2d4d33bc2cef1a6e152416de70840421390351c2..e7d0b96191a992c2c689e0621dcb5088fc9ebeec 100644 (file)
@@ -175,6 +175,14 @@ int WINS_Init(void)
        // determine my name & address
        gethostname(buff, MAXHOSTNAMELEN);
        local = gethostbyname(buff);
+
+       // When hostname can not be resolved, return gracefully
+       if( local == 0 )
+       {
+               WinError("WINS_Init: Unable to resolve hostname\n");
+               return 0;
+       }
+
        myAddr = *(int *)local->h_addr_list[0];
 
        // if the quake hostname isn't set, set it to the machine name