Core/Maps: Fix crash caused by setActive(false) called after DespawnOrUnsummon()

Fix crash caused by WorldObject::setActive(false) called after WorldObject::DespawnOrUnsummon() happening because the WorldObject would be set as not active but then Map::RemoveFromActiveHelper() would not be called because of not being in world anymore.
Whenever setActive() gets desync'd with what Map actually contains a rare crash would happen since Map only reads a few values of the active WorldObject, making it hard to reproduce. If this happens again some ASSERT calls should be added (or a check in Map::RemoveFromMap() could be added about if the WorldObject is in Map::m_activeNonPlayers container).

(cherry picked from commit 1c833f28e4)
This commit is contained in:
jackpoz
2019-04-27 13:57:46 +02:00
committed by Shauren
parent 36e009baf2
commit dd825c5614

View File

@@ -828,7 +828,7 @@ void WorldObject::setActive(bool on)
m_isActive = on;
if (!IsInWorld())
if (on && !IsInWorld())
return;
Map* map = FindMap();