Core/Spells: Fixed possible null pointer dereference

Coverity CID 1357406
This commit is contained in:
Shauren
2016-07-18 20:26:05 +02:00
parent df53a080fc
commit cc07a491f6

View File

@@ -10711,7 +10711,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));
}
@@ -10722,6 +10722,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));
}