From: Cloudwalk Date: Wed, 23 Sep 2020 14:05:09 +0000 (-0400) Subject: sv_main: Set server protocol before the server progs initializes, fixing crash X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ab02885719d1e7480469ca0a29256dc17e3d58ea;p=xonotic%2Fdarkplaces.git sv_main: Set server protocol before the server progs initializes, fixing crash --- diff --git a/sv_main.c b/sv_main.c index 92adb255..7d86bd06 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3511,6 +3511,15 @@ void SV_SpawnServer (const char *map) Con_Printf(CON_WARN "NOTE: random seed is %d; use for debugging/benchmarking only!\nUnset sv_random_seed to get real random numbers again.\n", sv_random_seed.integer); } + sv.protocol = Protocol_ForName(sv_protocolname.string); + if (!sv.protocol) + { + char buffer[1024]; + Protocol_Names(buffer, sizeof(buffer)); + Con_Printf(CON_ERROR "Unknown sv_protocolname \"%s\", valid values are:\n%s\n", sv_protocolname.string, buffer); + sv.protocol = &protocol_netquake; + } + SV_VM_Setup(); sv.active = true; @@ -3525,15 +3534,6 @@ void SV_SpawnServer (const char *map) Cvar_SetQuick(&sv_worldnamenoextension, sv.worldnamenoextension); Cvar_SetQuick(&sv_worldbasename, sv.worldbasename); - sv.protocol = Protocol_ForName(sv_protocolname.string); - if (!sv.protocol) - { - char buffer[1024]; - Protocol_Names(buffer, sizeof(buffer)); - Con_Printf(CON_ERROR "Unknown sv_protocolname \"%s\", valid values are:\n%s\n", sv_protocolname.string, buffer); - sv.protocol = &protocol_netquake; - } - // load progs to get entity field count //PR_LoadProgs ( sv_progs.string );