1
0
mirror of https://github.com/Mauler125/r5sdk.git synced 2025-02-09 19:15:03 +01:00

Common: fix crash on dedicated server

First change callback of cvar 'mp_gamemode' must be removed as its client only, calling this on the server causes a crash as we never initialize client specific systems, therefore, the globals used in the change callback are null.
This commit is contained in:
Kawe Mazidjatari 2024-09-25 20:01:10 +02:00
parent 9a68b15412
commit 3b1622af95

@ -273,6 +273,12 @@ void ConVar_InitShipped(void)
base_tickinterval_mp->RemoveFlags(FCVAR_DEVELOPMENTONLY);
mp_gamemode->RemoveFlags(FCVAR_DEVELOPMENTONLY);
#ifdef DEDICATED
// The base callback is for client builds only, must be removed from the
// dedicated server as it features client globals.
mp_gamemode->RemoveChangeCallback(mp_gamemode->GetChangeCallback(0), 0);
#endif // DEDICATED
mp_gamemode->InstallChangeCallback(MP_GameMode_Changed_f, nullptr, false);
net_usesocketsforloopback->RemoveFlags(FCVAR_DEVELOPMENTONLY);
#ifndef DEDICATED