fix(Core/Spells): add several missing null checks for the DamageInfo struct to fix a crash - Part II. (#8376)

This commit is contained in:
UltraNix
2021-10-10 15:56:42 +02:00
committed by GitHub
parent 760e043116
commit 66809383d1
13 changed files with 48 additions and 41 deletions

View File

@@ -585,8 +585,8 @@ public:
bool CheckProc(ProcEventInfo& eventInfo)
{
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo || !eventInfo.GetActionTarget())
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo || !eventInfo.GetActionTarget() || !eventInfo.GetDamageInfo())
return false;
if (!roll_chance_f(eventInfo.GetActor()->GetUnitCriticalChance(BASE_ATTACK, eventInfo.GetActionTarget())))
@@ -660,7 +660,7 @@ public:
void HandleProc(ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea())
if (!eventInfo.GetSpellInfo() || !eventInfo.GetSpellInfo()->IsTargetingArea())
DropCharge();
}
@@ -689,7 +689,7 @@ public:
void HandleProc(ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (eventInfo.GetDamageInfo()->GetDamage() > 0 && (!eventInfo.GetDamageInfo()->GetSpellInfo() || eventInfo.GetDamageInfo()->GetSpellInfo()->Dispel != DISPEL_DISEASE))
if (eventInfo.GetDamageInfo() && eventInfo.GetDamageInfo()->GetDamage() > 0 && (!eventInfo.GetSpellInfo() || eventInfo.GetSpellInfo()->Dispel != DISPEL_DISEASE))
SetDuration(0);
}
@@ -770,7 +770,7 @@ public:
if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || eventInfo.GetActor()->GetTypeId() != TYPEID_PLAYER)
return false;
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return true;
@@ -815,7 +815,7 @@ public:
return;
dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
if (const SpellInfo* procSpell = eventInfo.GetSpellInfo())
{
// xinef: ugly hack
if (!procSpell->IsAffectingArea())
@@ -823,7 +823,7 @@ public:
dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 0.01f);
}
else
else if (eventInfo.GetDamageInfo())
{
target = player->GetMeleeHitRedirectTarget(target);
CalcDamageInfo damageInfo;