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 committed 2011-06-11 12:42:01 +02:00
1 parent 252ac95e1b
commit 677cbbb93a
12 files changed
+100 -79

No files matched your search

+13 -15
View File
@@ -644,23 +644,21 @@ public:
{
if (Unit* caster = GetCaster())
{
if (Unit* target = GetTarget())
Unit* target = GetTarget();
if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
switch(target->GetEntry())
{
switch(target->GetEntry())
{
case NPC_FROSTWORG:
target->CastSpell(player, SPELL_FROSTWORG_CREDIT, true);
target->CastSpell(target, SPELL_IMMOLATION, true);
target->CastSpell(target, SPELL_ABLAZE, true);
break;
case NPC_FROSTGIANT:
target->CastSpell(player, SPELL_FROSTGIANT_CREDIT, true);
target->CastSpell(target, SPELL_IMMOLATION, true);
target->CastSpell(target, SPELL_ABLAZE, true);
break;
}
case NPC_FROSTWORG:
target->CastSpell(player, SPELL_FROSTWORG_CREDIT, true);
target->CastSpell(target, SPELL_IMMOLATION, true);
target->CastSpell(target, SPELL_ABLAZE, true);
break;
case NPC_FROSTGIANT:
target->CastSpell(player, SPELL_FROSTGIANT_CREDIT, true);
target->CastSpell(target, SPELL_IMMOLATION, true);
target->CastSpell(target, SPELL_ABLAZE, true);
break;
}
}
}