aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-01-19 07:17:04 -0300
committerariel- <ariel-@users.noreply.github.com>2017-01-19 07:20:02 -0300
commit7283cbe140c51b917277e30ec352da84f0330c5c (patch)
tree098fca093d2d2657c550910e76927f97713124fb /src
parent39b20b4431a1a67446e9cc4c2221fd42cc907291 (diff)
Core/Spell: add missing null caster check
01d272d6cb348c968c531620c341f760e50cb97b follow-up Closes #18875
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 28e4ca4fb03..9ec729f741e 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -7942,11 +7942,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;