fix(Core/Spells): possible crashes within class spells (#9168)
This commit is contained in:
parent
92b3617f63
commit
61c7488698
9 changed files with 66 additions and 25 deletions
|
|
@ -706,12 +706,17 @@ class spell_hun_sniper_training : public AuraScript
|
|||
PreventDefaultAction();
|
||||
if (aurEff->GetAmount() <= 0)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
|
||||
if (Unit* target = GetTarget())
|
||||
if (!GetCaster() || !GetTarget())
|
||||
{
|
||||
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(GetSpellInfo()) ? caster : target;
|
||||
return;
|
||||
}
|
||||
|
||||
Unit* target = GetTarget();
|
||||
|
||||
uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
|
||||
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId))
|
||||
{
|
||||
Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(GetSpellInfo()) ? GetCaster() : target;
|
||||
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
|
||||
}
|
||||
}
|
||||
|
|
@ -1119,7 +1124,7 @@ class spell_hun_lock_and_load : public AuraScript
|
|||
bool CheckTrapProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
if (!spellInfo || !eventInfo.GetActor())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue