Protect against server crash when DHooks cannot load from SDKHooks not being loaded. (#1930)

This commit is contained in:
Nicholas Hastings 2023-02-08 19:10:14 -05:00 committed by GitHub
parent 43cdc65708
commit 6bd49ff415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,7 +119,10 @@ void DHooks::SDK_OnAllLoaded()
SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
SM_GET_LATE_IFACE(SDKHOOKS, g_pSDKHooks);
g_pSDKHooks->AddEntityListener(g_pEntityListener);
if (g_pSDKHooks)
{
g_pSDKHooks->AddEntityListener(g_pEntityListener);
}
gameconfs->AddUserConfigHook("Functions", g_pSignatures);
}
@ -131,7 +134,10 @@ void DHooks::SDK_OnUnload()
{
g_pEntityListener->CleanupListeners();
g_pEntityListener->CleanupRemoveList();
g_pSDKHooks->RemoveEntityListener(g_pEntityListener);
if (g_pSDKHooks)
{
g_pSDKHooks->RemoveEntityListener(g_pEntityListener);
}
delete g_pEntityListener;
}
plsys->RemovePluginsListener(this);