mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: Added checks for procSpell nullptr cases
Fixes Coverity Defect ID: 1023036
This commit is contained in:
@@ -5714,7 +5714,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
if (dummySpell->SpellIconID == 1697)
|
||||
{
|
||||
// only for spells and hit/crit (trigger start always) and not start from self cast spells (5530 Mace Stun Effect for example)
|
||||
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 stun or root mechanic
|
||||
if (!(procSpell->GetAllEffectsMechanicMask() & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_STUN))))
|
||||
@@ -5911,7 +5911,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Vampiric Embrace
|
||||
case 15286:
|
||||
{
|
||||
if (!victim || !victim->IsAlive() || procSpell->SpellFamilyFlags[1] & 0x80000)
|
||||
if (!victim || !victim->IsAlive() || !procSpell || procSpell->SpellFamilyFlags[1] & 0x80000)
|
||||
return false;
|
||||
|
||||
// heal amount
|
||||
@@ -5925,7 +5925,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)
|
||||
@@ -5989,7 +5991,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Priest T10 Healer 2P Bonus
|
||||
case 70770:
|
||||
// Flash Heal
|
||||
if (procSpell->SpellFamilyFlags[0] & 0x800)
|
||||
if (procSpell && procSpell->SpellFamilyFlags[0] & 0x800)
|
||||
{
|
||||
triggered_spell_id = 70772;
|
||||
SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
|
||||
@@ -6008,7 +6010,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Glyph of Innervate
|
||||
case 54832:
|
||||
{
|
||||
if (procSpell->SpellIconID != 62)
|
||||
if (!procSpell || procSpell->SpellIconID != 62)
|
||||
return false;
|
||||
|
||||
int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
|
||||
@@ -6058,7 +6060,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Glyph of Rake
|
||||
case 54821:
|
||||
{
|
||||
if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
|
||||
if (procSpell && procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
|
||||
{
|
||||
if (target && target->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
@@ -6088,10 +6090,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Healing Touch (Dreamwalker Raiment set)
|
||||
case 28719:
|
||||
{
|
||||
// mana back
|
||||
basepoints0 = int32(CalculatePct(procSpell->ManaCost, 30));
|
||||
target = this;
|
||||
triggered_spell_id = 28742;
|
||||
if (procSpell)
|
||||
{
|
||||
// mana back
|
||||
basepoints0 = int32(CalculatePct(procSpell->ManaCost, 30));
|
||||
target = this;
|
||||
triggered_spell_id = 28742;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Glyph of Rejuvenation
|
||||
@@ -6123,8 +6128,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
{
|
||||
float chance;
|
||||
|
||||
if (!procSpell)
|
||||
return false;
|
||||
// Starfire
|
||||
if (procSpell->SpellFamilyFlags[0] & 0x4)
|
||||
else if (procSpell->SpellFamilyFlags[0] & 0x4)
|
||||
{
|
||||
triggered_spell_id = 40445;
|
||||
chance = 25.0f;
|
||||
@@ -6161,7 +6168,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);
|
||||
@@ -6177,7 +6184,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
case 70664:
|
||||
{
|
||||
// Proc only from normal Rejuvenation
|
||||
if (procSpell->SpellVisual[0] != 32)
|
||||
if (!procSpell || procSpell->SpellVisual[0] != 32)
|
||||
return false;
|
||||
|
||||
Player* caster = ToPlayer();
|
||||
@@ -6308,7 +6315,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
case 3560: // Rapid Recuperation
|
||||
{
|
||||
// This effect only from Rapid Killing (mana regen)
|
||||
if (!(procSpell->SpellFamilyFlags[1] & 0x01000000))
|
||||
if (!procSpell || !(procSpell->SpellFamilyFlags[1] & 0x01000000))
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
@@ -6350,7 +6357,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Light's Beacon - Beacon of Light
|
||||
if (dummySpell->Id == 53651)
|
||||
{
|
||||
if (!victim)
|
||||
if (!victim || !procSpell)
|
||||
return false;
|
||||
triggered_spell_id = 0;
|
||||
Unit* beaconTarget = NULL;
|
||||
@@ -6511,9 +6518,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
return false;
|
||||
|
||||
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
|
||||
bool stacker = !procSpell || procSpell->Id == 53595;
|
||||
bool stacker = procSpell ? procSpell->Id == 53595 : true;
|
||||
// spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
|
||||
bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
|
||||
bool damager = procSpell ? (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39)) : false;
|
||||
|
||||
if (!stacker && !damager)
|
||||
return false;
|
||||
@@ -6543,9 +6550,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
return false;
|
||||
|
||||
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
|
||||
bool stacker = !procSpell || procSpell->Id == 53595;
|
||||
bool stacker = procSpell ? procSpell->Id == 53595 : true;
|
||||
// spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
|
||||
bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
|
||||
bool damager = procSpell ? (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39)) : false;
|
||||
|
||||
if (!stacker && !damager)
|
||||
return false;
|
||||
@@ -6892,7 +6899,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);
|
||||
@@ -6906,7 +6913,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);
|
||||
@@ -6942,7 +6949,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
}
|
||||
case 63280: // Glyph of Totem of Wrath
|
||||
{
|
||||
if (procSpell->SpellIconID != 2019)
|
||||
if (!procSpell || procSpell->SpellIconID != 2019)
|
||||
return false;
|
||||
|
||||
if (Creature* totem = GetMap()->GetCreature(m_SummonSlot[1])) // Fire totem summon slot
|
||||
@@ -7034,7 +7041,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Default chance for Healing Wave and Riptide
|
||||
float chance = (float)triggeredByAura->GetAmount();
|
||||
|
||||
if (procSpell->SpellFamilyFlags[0] & 0x80)
|
||||
if (!procSpell)
|
||||
return false; //This is the same than putting chance *= 0.0f;
|
||||
else if (procSpell->SpellFamilyFlags[0] & 0x80)
|
||||
// Lesser Healing Wave - 0.6 of default
|
||||
chance *= 0.6f;
|
||||
else if (procSpell->SpellFamilyFlags[0] & 0x100)
|
||||
@@ -7289,7 +7298,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))))
|
||||
@@ -7348,7 +7357,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
case SPELLFAMILY_POTION:
|
||||
{
|
||||
// alchemist's stone
|
||||
if (dummySpell->Id == 17619)
|
||||
if (procSpell && dummySpell->Id == 17619)
|
||||
{
|
||||
if (procSpell->SpellFamilyName == SPELLFAMILY_POTION)
|
||||
{
|
||||
@@ -7380,7 +7389,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Guard Dog
|
||||
case 201:
|
||||
{
|
||||
if (!victim)
|
||||
if (!victim || !procSpell)
|
||||
return false;
|
||||
|
||||
triggered_spell_id = 54445;
|
||||
|
||||
Reference in New Issue
Block a user