diff options
| author | StormBytePP <stormbyte@gmail.com> | 2015-08-20 16:23:26 +0200 |
|---|---|---|
| committer | Carbenium <carbenium@outlook.com> | 2015-09-24 22:54:17 +0200 |
| commit | b3eb1ead96dadc2c6638a201982f7286c45335cb (patch) | |
| tree | 1d6df7bd0d3a842c2b6ce3d96e48eb6d357c7ec4 /src | |
| parent | 7005089241e7bc7f0773810469ffcd9a4f67d200 (diff) | |
Core/Misc: Added checks for procSpell nullptr cases
Fixes Coverity Defect ID: 1023036
(cherry picked from commit 424576e098635f947074d26b088790fce62a07d1)
Conflicts:
src/server/game/Entities/Unit/Unit.cpp
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1c9b33de2c2..ce669b77c59 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5473,7 +5473,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 40438: { // Shadow Word: Pain - if (procSpell->SpellFamilyFlags[0] & 0x8000) + if (!procSpell) + return false; + else if (procSpell->SpellFamilyFlags[0] & 0x8000) triggered_spell_id = 40441; // Renew else if (procSpell->SpellFamilyFlags[0] & 0x40) @@ -5566,6 +5568,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Healing Touch (Dreamwalker Raiment set) case 28719: { + if (!procSpell) + return false; // mana back std::vector<SpellInfo::CostData> costs = procSpell->CalcPowerCost(this, procSpell->GetSchoolMask()); auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; }); @@ -5597,6 +5601,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere { float chance; + if (!procSpell) + return false; // Starfire if (procSpell->SpellFamilyFlags[0] & 0x4) { @@ -5628,7 +5634,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 70723: { // Wrath & Starfire - if ((procSpell->SpellFamilyFlags[0] & 0x5) && (procEx & PROC_EX_CRITICAL_HIT)) + if (procSpell && (procSpell->SpellFamilyFlags[0] & 0x5) && (procEx & PROC_EX_CRITICAL_HIT)) { triggered_spell_id = 71023; SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id); @@ -5647,7 +5653,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 70664: { // Proc only from normal Rejuvenation - if (procSpell->Id != 774) + if (!procSpell || procSpell->Id != 774) return false; Player* caster = ToPlayer(); @@ -6015,7 +6021,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 67228: { // Lava Burst - if (procSpell->SpellFamilyFlags[1] & 0x1000) + if (procSpell && procSpell->SpellFamilyFlags[1] & 0x1000) { triggered_spell_id = 71824; SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id); @@ -6030,7 +6036,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 70808: { // Chain Heal - if ((procSpell->SpellFamilyFlags[0] & 0x100) && (procEx & PROC_EX_CRITICAL_HIT)) + if (procSpell && (procSpell->SpellFamilyFlags[0] & 0x100) && (procEx & PROC_EX_CRITICAL_HIT)) { triggered_spell_id = 70809; SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id); @@ -6156,7 +6162,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (dummySpell->Id == 61257) { // only for spells and hit/crit (trigger start always) and not start from self cast spells - if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == victim) + if (!procSpell || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == victim) return false; // Need snare or root mechanic if (!(procSpell->GetAllEffectsMechanicMask() & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_SNARE)))) |
