Skip to content

Commit

Permalink
Protect against server crash when DHooks cannot load from SDKHooks no…
Browse files Browse the repository at this point in the history
…t being loaded. (#1930)
  • Loading branch information
psychonic committed Feb 9, 2023
1 parent 43cdc65 commit 6bd49ff
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions extensions/dhooks/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
Expand Down

0 comments on commit 6bd49ff

Please sign in to comment.