fix(Core/Spells): add several missing null checks for the DamageInfo struct to fix a crash (#8322)

This commit is contained in:
Skjalf
2021-10-10 11:07:14 -03:00
committed by GitHub
parent 66809383d1
commit 1e57b6fb99
13 changed files with 146 additions and 22 deletions

View File

@@ -670,7 +670,9 @@ public:
{
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_HEAL))
{
return false;
}
return spellInfo->ManaCost > 0 || spellInfo->ManaCostPercentage > 0 || (spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && spellInfo->SpellIconID == 156);
}
@@ -2418,7 +2420,15 @@ public:
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 bp = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount());
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
GetTarget()->CastCustomSpell(SPELL_ITEM_NECROTIC_TOUCH_PROC, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, nullptr, aurEff);
}