fix(Core/Combat): drop dangling current victim on phase change crash (#26020)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-05-29 09:22:01 -05:00
committed by GitHub
parent c029eab828
commit 46f0d4033a
2 changed files with 5 additions and 21 deletions

View File

@@ -15321,30 +15321,10 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
return;
// Phase-related threat updates are done AFTER the phase change below
}
WorldObject::SetPhaseMask(newPhaseMask, false);
// Now update threat online states with the new phase mask applied
if (IsCreature() || (IsPlayer() && !ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
{
// Update online state for units that have me on their threat list
for (auto const& pair : GetThreatMgr().GetThreatenedByMeList())
{
if (ThreatReference* ref = pair.second)
ref->UpdateOffline();
}
// Update online state for units on my threat list
if (!IsPlayer())
{
for (ThreatReference* ref : GetThreatMgr().GetModifiableThreatList())
ref->UpdateOffline();
}
}
if (!IsInWorld())
{
return;