Fix crash when accessing gamerules during mapchange (#593)

If the gamerules proxy entity doesn't exist, don't try to generate the
reference for it.
This commit is contained in:
peace-maker 2017-03-11 09:54:38 -07:00 committed by Kyle Sanderson
parent 89c4be525b
commit 0961e5dde3

View File

@ -70,7 +70,8 @@ static CBaseEntity* GetGameRulesProxyEnt()
if (proxyEntRef == -1 || (pProxy = gamehelpers->ReferenceToEntity(proxyEntRef)) == NULL) if (proxyEntRef == -1 || (pProxy = gamehelpers->ReferenceToEntity(proxyEntRef)) == NULL)
{ {
pProxy = FindEntityByNetClass(playerhelpers->GetMaxClients(), g_szGameRulesProxy); pProxy = FindEntityByNetClass(playerhelpers->GetMaxClients(), g_szGameRulesProxy);
proxyEntRef = gamehelpers->EntityToReference(pProxy); if (pProxy)
proxyEntRef = gamehelpers->EntityToReference(pProxy);
} }
return pProxy; return pProxy;