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

@@ -824,7 +824,15 @@ public:
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 heal = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount());
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 heal = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, nullptr, aurEff);
}

View File

@@ -3536,7 +3536,15 @@ public:
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 heal = int32(eventInfo.GetDamageInfo()->GetDamage() / 2);
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 heal = static_cast<int32>(damageInfo->GetDamage() / 2);
GetTarget()->CastCustomSpell(SPELL_DARK_HUNGER_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, nullptr, aurEff);
}