From 465b5041f3cac97e645b559727c517bba1d8d59f Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 11 Feb 2007 22:05:50 +0000 Subject: [PATCH] This fixes a defect which could cause the game to crash when a duke3d_w32 network configuration file without explicitly defined ports is used. git-svn-id: https://svn.eduke32.com/eduke32@486 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index a22351945..379e1dd89 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3217,14 +3217,14 @@ void displayrest(long smoothratio) dotint = 1; } // reset a normal palette - /* else */ if (restorepalette) + else if (restorepalette) { //setbrightness(ud.brightness>>2,&pp->palette[0],0); setgamepalette(pp,pp->palette,2); restorepalette = 0; } // loogies courtesy of being snotted on - /* else */ if (pp->loogcnt > 0) + else if (pp->loogcnt > 0) { //palto(0,64,0,(pp->loogcnt>>1)+128); fader = 0; @@ -8183,10 +8183,17 @@ static int load_rancid_net(char *fn) if (scriptfile_getstring(script,&ip)) break; Bstrcpy(rancid_ip_strings[MAXPLAYERS-1],ip); Bstrcpy(rancid_ip_strings[rancid_players++],ip); - strtok(ip,":"); - Bsprintf(tempbuf,"%s",strtok(NULL,":")); - if (atoi(tempbuf) > 1024) - Bsprintf(rancid_local_port_string,"-p %s",tempbuf); + if (strtok(ip,":")) + { + char *p = strtok(NULL,":"); + + if (p != NULL) + { + Bsprintf(tempbuf,"%s",p); + if (atoi(tempbuf) > 1024) + Bsprintf(rancid_local_port_string,"-p %s",tempbuf); + } + } } break; case T_MODE: