From 194a0daed50c85f1b598494af7de7b9f9d1ad0b7 Mon Sep 17 00:00:00 2001 From: HelloKitty Date: Tue, 22 Mar 2022 05:40:31 -0500 Subject: Core/Object: Fix WorldObject::SetZoneScript unsafe cast to InstanceMap (#27877) (cherry picked from commit e9992066a5ccd7f085a56de09ea027240e8da873) --- src/server/game/Entities/Object/Object.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 1363585b64c..129ac5a7988 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1925,8 +1925,8 @@ void WorldObject::SetZoneScript() { if (Map* map = FindMap()) { - if (map->IsDungeon()) - m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript(); + if (InstanceMap* instanceMap = map->ToInstanceMap()) + m_zoneScript = reinterpret_cast(instanceMap->GetInstanceScript()); else if (!map->IsBattlegroundOrArena()) { if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) -- cgit v1.2.3