Skip to content

Commit

Permalink
fix(Core/Map): Fix crash OnPlayerLeave() (azerothcore#21155)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah authored Jan 13, 2025
1 parent 8bd6661 commit 241d05f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3040,6 +3040,8 @@ void InstanceMap::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread

void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
{
if (instance_data)
instance_data->OnPlayerLeave(player);
// pussywizard: moved m_unloadTimer to InstanceMap::AfterPlayerUnlinkFromMap(), in this function if 2 players run out at the same time the instance won't close
//if (!m_unloadTimer && m_mapRefMgr.getSize() == 1)
// m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
Expand All @@ -3048,9 +3050,6 @@ void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
// If remove == true - player already deleted.
if (!remove)
player->SetPendingBind(0, 0);

if (instance_data)
instance_data->OnPlayerLeave(player);
}

void InstanceMap::AfterPlayerUnlinkFromMap()
Expand Down

0 comments on commit 241d05f

Please sign in to comment.