Fix some crashes caused by spell scripts without checking unit type. Fix #3216 and #3217.

This commit is contained in:
megamage
2011-09-26 09:03:33 -04:00
parent 738f94eed3
commit a35deba186
2 changed files with 8 additions and 8 deletions

View File

@@ -237,12 +237,12 @@ class spell_intense_cold : public SpellScriptLoader
void HandlePeriodicTick(AuraEffect const* aurEff)
{
Unit* caster = GetCaster();
if (!caster)
if (aurEff->GetBase()->GetStackAmount() < 2)
return;
if (aurEff->GetBase()->GetStackAmount() >= 2)
caster->GetAI()->SetGUID(GetTarget()->GetGUID(), DATA_INTENSE_COLD);
Unit* caster = GetCaster();
if (!caster || !caster->GetAI())
return;
caster->GetAI()->SetGUID(GetTarget()->GetGUID(), DATA_INTENSE_COLD);
}
void Register()

View File

@@ -167,9 +167,9 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
{
SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster());
// assume caster is a player here
if (Unit* caster = GetCaster())
amount += int32(2 * caster->ToPlayer()->GetTotalAttackPowerValue(BASE_ATTACK));
Unit* caster = GetCaster();
if(Player* player = caster->ToPlayer())
amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK));
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)