Fix weird server crash

This commit is contained in:
Kyle
2022-10-30 17:15:36 +08:00
parent b44f1a8880
commit 234a1316ac
+13 -7
View File
@@ -50,7 +50,7 @@ struct HookingEntity
V_strcasecmp(pName, "cfe_player_decal") == 0 || V_strcasecmp(pName, "cfe_player_decal") == 0 ||
V_strcasecmp(pName, "func_precipitation") == 0 || V_strcasecmp(pName, "func_precipitation") == 0 ||
V_strcasecmp(pName, "cs_ragdoll") == 0 || V_strcasecmp(pName, "cs_ragdoll") == 0 ||
V_strcasecmp(pName, "info_target") == 0 || V_strcasecmp(pName, "info_target") == 0 ||
V_strncasecmp(pName, "point_viewcontrol", 17) == 0 || V_strncasecmp(pName, "point_viewcontrol", 17) == 0 ||
@@ -131,6 +131,12 @@ void TransmitManager::Hook_SetTransmit(CCheckTransmitInfo* pInfo, bool bAlways)
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
if (g_Hooked[entity] == nullptr)
{
smutils->LogError(myself, "Why Hooked Entity is nullptr <%d.%s>", entity, gamehelpers->GetEntityClassname(bcref));
RETURN_META(MRES_IGNORED);
}
if (g_Hooked[entity]->ShouldRemove()) if (g_Hooked[entity]->ShouldRemove())
{ {
auto flags = edict->m_fStateFlags; auto flags = edict->m_fStateFlags;
@@ -168,13 +174,13 @@ void TransmitManager::Hook_SetTransmit(CCheckTransmitInfo* pInfo, bool bAlways)
bool TransmitManager::SDK_OnLoad(char* error, size_t maxlength, bool late) bool TransmitManager::SDK_OnLoad(char* error, size_t maxlength, bool late)
{ {
sharesys->AddDependency(myself, "sdkhooks.ext", true, true); sharesys->AddDependency(myself, "sdkhooks.ext", true, true);
SM_GET_IFACE(SDKHOOKS, g_pSDKHooks) SM_GET_IFACE(SDKHOOKS, g_pSDKHooks);
if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, error, maxlength)) if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, error, maxlength))
{ {
smutils->Format(error, maxlength, "Failed to load SDKHooks gamedata."); smutils->Format(error, maxlength, "Failed to load SDKHooks gamedata.");
return false; return false;
} }
auto offset = -1; auto offset = -1;
if (!g_pGameConf->GetOffset("SetTransmit", &offset)) if (!g_pGameConf->GetOffset("SetTransmit", &offset))