aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-01-19 07:17:04 -0300
committerShauren <shauren.trinity@gmail.com>2018-12-09 14:18:42 +0100
commit0a0042282b2d5cfcacbc7cc498211efb60bb1b0c (patch)
tree1eaeb4e5020bbdaa0ea5229a2d951c102105e20c /src
parenta31a828a400da86addab060b74e293c7cfc9b716 (diff)
Core/Spell: add missing null caster check
01d272d6cb348c968c531620c341f760e50cb97b follow-up Closes #18875 (cherry-picked from 7283cbe140c51b917277e30ec352da84f0330c5c)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 476ec9a351a..5ff00d80976 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -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;