From 0d152e932cdd986f62ae22bd9fc40569892a2453 Mon Sep 17 00:00:00 2001 From: Ovah Date: Tue, 15 Sep 2020 14:49:18 +0200 Subject: Core/Spells: fix a possible crash when a target that has been focused during spell casts disappears --- src/server/game/Spells/Spell.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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(); -- cgit v1.2.3