mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
fix(Core/Scripts): Fix build and crash when calling uninitialized scripts (#18718)
fix(Core/Scripts): Fix build and crash when calling uninitialized scripts.
This commit is contained in:
committed by
GitHub
parent
f05200fcca
commit
3a6231cb65
@@ -725,6 +725,11 @@ public:
|
||||
// With this approach, we wouldn't call all available hooks in case if we override just one hook.
|
||||
static EnabledHooksVector EnabledHooks;
|
||||
|
||||
static void InitEnabledHooksIfNeeded(uint16 totalAvailableHooks)
|
||||
{
|
||||
EnabledHooks.resize(totalAvailableHooks);
|
||||
}
|
||||
|
||||
static void AddScript(TScript* const script, std::vector<uint16> enabledHooks = {})
|
||||
{
|
||||
ASSERT(script);
|
||||
@@ -733,7 +738,7 @@ public:
|
||||
return;
|
||||
|
||||
if (EnabledHooks.empty())
|
||||
EnabledHooks.resize(script->GetTotalAvailableHooks());
|
||||
InitEnabledHooksIfNeeded(script->GetTotalAvailableHooks());
|
||||
|
||||
if (script->isAfterLoadScript())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user