Scripts: Fix some crashes occuring due to unsafe use of AuraScript::GetCaster() method.
There's "returns unit which casted the aura or NULL if not avalible" written in description of the method, but who cares...
This commit is contained in:
1 parent
252ac95e1b
commit
677cbbb93a
12 files changed
+100
-79
No files matched your search
@@ -363,12 +363,17 @@ public:
|
||||
if (aurEff->GetAmount() > 0)
|
||||
return;
|
||||
|
||||
Unit * caster = GetCaster();
|
||||
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1;
|
||||
Unit * pTarget = GetTarget();
|
||||
if (!pTarget->HasAura(spellId))
|
||||
{
|
||||
SpellEntry const * triggeredSpellInfo = sSpellStore.LookupEntry(spellId);
|
||||
Unit* triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, GetCaster(), pTarget);
|
||||
Unit* triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, pTarget);
|
||||
triggerCaster->CastSpell(pTarget, triggeredSpellInfo, true, 0, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user