From 899bfdf7f2fffda998b1e4b2484b71273b99ecd0 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Fri, 2 Oct 2020 02:26:44 +0000 Subject: [PATCH] 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 --- sv_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.39.2