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:
parent
f05200fcca
commit
3a6231cb65
7 changed files with 17 additions and 1 deletions
|
|
@ -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())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue