mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: fix a possible crash when a target that has been focused during spell casts disappears
(cherry picked from commit 0d152e932c)
This commit is contained in:
@@ -3552,7 +3552,8 @@ void Spell::_cast(bool skipCheck)
|
||||
// The spell focusing is making sure that we have a valid cast target guid when we need it so only check for a guid value here.
|
||||
if (Creature* creatureCaster = m_caster->ToCreature())
|
||||
if (!creatureCaster->GetTarget().IsEmpty() && !creatureCaster->HasUnitFlag(UNIT_FLAG_POSSESSED))
|
||||
creatureCaster->SetInFront(ObjectAccessor::GetUnit(*creatureCaster, creatureCaster->GetTarget()));
|
||||
if (WorldObject const* target = ObjectAccessor::GetUnit(*creatureCaster, creatureCaster->GetTarget()))
|
||||
creatureCaster->SetInFront(target);
|
||||
|
||||
SelectSpellTargets();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user