Core/Spell: add missing null caster check

01d272d6cb follow-up

Closes #18875

(cherry-picked from 7283cbe140)
This commit is contained in:
ariel-
2017-01-19 07:17:04 -03:00
committed by Shauren
parent a31a828a40
commit 0a0042282b

View File

@@ -7212,11 +7212,13 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
for (auto itr = schoolList.begin(); itr != schoolList.end(); ++itr)
{
if (!(itr->first & spellInfo->GetSchoolMask()))
continue;
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second);
if ((itr->first & spellInfo->GetSchoolMask())
&& !(immuneSpellInfo && immuneSpellInfo->IsPositive() && spellInfo->IsPositive() && IsFriendlyTo(caster))
&& !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
return true;
if (!(immuneSpellInfo && immuneSpellInfo->IsPositive() && spellInfo->IsPositive() && caster && IsFriendlyTo(caster)))
if (!spellInfo->CanPierceImmuneAura(immuneSpellInfo))
return true;
}
return false;