diff options
author | Ovah <dreadkiller@gmx.de> | 2020-09-15 14:49:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 14:49:18 +0200 |
commit | 0d152e932cdd986f62ae22bd9fc40569892a2453 (patch) | |
tree | 1558e98965be2778cf25985906652da282e7118c | |
parent | 39a436bd658790d39d3cfa64e18f49544475dfe3 (diff) |
Core/Spells: fix a possible crash when a target that has been focused during spell casts disappears
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ea34d8c2ddc..534a45d4e3d 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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(); |