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
This commit is contained in:
@@ -3366,7 +3366,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->HasFlag(UNIT_FIELD_FLAGS, 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