Core/Spells: Fixed possible null pointer dereference

Coverity CID 1357406

(cherry picked from commit cc07a491f64fa958c8a27079bd2def84c577f816)
This commit is contained in:
Shauren authored and Aokromes committed 2016-08-20 15:54:14 +02:00
1 parent 7ea03a2e47
commit a778c8033f
1 file changed
+3 -1
+3 -1
View File
@@ -11647,7 +11647,7 @@ float Unit::GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spell
return 0;
if (spellInfo->RangeEntry->maxRangeFriend == spellInfo->RangeEntry->maxRangeHostile)
return spellInfo->GetMaxRange();
if (target == NULL)
if (!target)
return spellInfo->GetMaxRange(true);
return spellInfo->GetMaxRange(!IsHostileTo(target));
}
@@ -11658,6 +11658,8 @@ float Unit::GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spell
return 0;
if (spellInfo->RangeEntry->minRangeFriend == spellInfo->RangeEntry->minRangeHostile)
return spellInfo->GetMinRange();
if (!target)
return spellInfo->GetMinRange(true);
return spellInfo->GetMinRange(!IsHostileTo(target));
}