aboutsummaryrefslogtreecommitdiff
path: root/src/game/UnitAI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/UnitAI.cpp')
-rw-r--r--src/game/UnitAI.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/game/UnitAI.cpp b/src/game/UnitAI.cpp
index d0a013393ba..728e6f36916 100644
--- a/src/game/UnitAI.cpp
+++ b/src/game/UnitAI.cpp
@@ -83,10 +83,10 @@ bool UnitAI::DoSpellAttackIfReady(uint32 spell)
inline bool SelectTargetHelper(const Unit * me, const Unit * target, const bool &playerOnly, const float &dist, const int32 &aura)
{
- if(playerOnly && target->GetTypeId() != TYPEID_PLAYER)
+ if(playerOnly && (!target || target->GetTypeId() != TYPEID_PLAYER))
return false;
- if(dist && !me->IsWithinCombatRange(target, dist))
+ if(dist && (!me || !target || !me->IsWithinCombatRange(target, dist)))
return false;
if(aura)