]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
sv_main: Set server protocol before the server progs initializes, fixing crash
authorCloudwalk <cloudwalk009@gmail.com>
Wed, 23 Sep 2020 14:05:09 +0000 (10:05 -0400)
committerCloudwalk <cloudwalk009@gmail.com>
Wed, 23 Sep 2020 14:05:09 +0000 (10:05 -0400)
sv_main.c

index 92adb2553d174e6d1e8aa730cbdcd6e3228219da..7d86bd063555c01a5f1558bab9c312330289f860 100644 (file)
--- 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 );