Core/Scripts: Fix Hotswap not reinitializing AIs after destroying them and then crashing due to AI being nullptr (#27744)

This commit is contained in:
Seyden
2022-02-15 22:36:48 +01:00
committed by GitHub
parent c0748d4285
commit 272addbf2b

View File

@@ -554,7 +554,7 @@ class CreatureGameObjectAreaTriggerScriptRegistrySwapHooks
// When the script Id of the script isn't removed in this
// context change, do nothing.
uint32 aiId = object.second->AI() ? object.second->AI()->GetId() : 0;
if (idsToRemove.find(aiId) != idsToRemove.end())
if (idsToRemove.find(aiId) != idsToRemove.end() || (aiId == 0 && object.second->GetScriptId()))
visitor(object.second);
}
};