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:
QAston
2011-06-11 12:42:01 +02:00
parent 252ac95e1b
commit 677cbbb93a
12 changed files with 100 additions and 79 deletions
@@ -311,14 +311,13 @@ class spell_baltharus_enervating_brand : public SpellScriptLoader
void HandleTriggerSpell(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* target = GetTarget())
{
uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
target->CastSpell(target, triggerSpellId, true);
Unit* target = GetTarget();
uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
target->CastSpell(target, triggerSpellId, true);
if (target->GetDistance(GetCaster()) <= 12.0f)
target->CastSpell(GetCaster(), SPELL_SIPHONED_MIGHT, true);
}
if (Unit * caster = GetCaster())
if (target->GetDistance(caster) <= 12.0f)
target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true);
}
void Register()