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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 146 additions and 22 deletions

View file

@ -812,15 +812,23 @@ public:
bool CheckProc(ProcEventInfo& eventInfo)
{
_procTarget = eventInfo.GetActor()->SelectNearbyNoTotemTarget(eventInfo.GetProcTarget());
return _procTarget && !eventInfo.GetDamageInfo()->GetSpellInfo();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetSpellInfo())
{
return false;
}
return _procTarget && !damageInfo->GetSpellInfo();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (eventInfo.GetDamageInfo())
if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
{
int32 damage = eventInfo.GetDamageInfo()->GetUnmitigatedDamage();
int32 damage = damageInfo->GetUnmitigatedDamage();
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, nullptr, aurEff);
}
}