From: cloudwalk Date: Fri, 2 Oct 2020 02:26:44 +0000 (+0000) Subject: sv_main: Fix segfault and logic bugs when saving. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=899bfdf7f2fffda998b1e4b2484b71273b99ecd0;p=xonotic%2Fdarkplaces.git sv_main: Fix segfault and logic bugs when saving. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12989 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sv_main.c b/sv_main.c index 1da0531e..463806d7 100644 --- a/sv_main.c +++ b/sv_main.c @@ -438,13 +438,13 @@ static qbool SV_CanSave(void) if(SV_IsLocalGame() == 1) { // singleplayer checks - if (!(svs.clients[0].active && PRVM_serveredictfloat(svs.clients[0].edict, deadflag))) + if ((svs.clients[0].active && PRVM_serveredictfloat(svs.clients[0].edict, deadflag))) { Con_Print("Can't savegame with a dead player\n"); return false; } - if(!host.hook.CL_Intermission || !host.hook.CL_Intermission()) + if(host.hook.CL_Intermission && host.hook.CL_Intermission()) { Con_Print("Can't save in intermission.\n"); return false; @@ -2020,7 +2020,7 @@ void SV_SpawnServer (const char *map) */ int SV_IsLocalGame(void) { - if (sv.active && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) == LHNETADDRESSTYPE_LOOP) + if (sv.active && &svs.clients[0] && LHNETADDRESS_GetAddressType(&svs.clients[0].netconnection->peeraddress) == LHNETADDRESSTYPE_LOOP) return svs.maxclients; return 0; }