*A temp fix for the crash caused by feared statue. I will push a better fix later. Thanks to Drahy.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-10 12:41:05 -05:00
parent 1576a44d38
commit c153f7f272
+7 -7
View File
@@ -2856,8 +2856,7 @@ void Spell::finish(bool ok)
m_caster->clearUnitState(UNIT_STAT_CASTING); m_caster->clearUnitState(UNIT_STAT_CASTING);
// Unsummon summon as possessed creatures on spell cancel // Unsummon summon as possessed creatures on spell cancel
if(IsChanneledSpell(m_spellInfo) if(IsChanneledSpell(m_spellInfo) && m_caster->GetTypeId() == TYPEID_PLAYER)
&& m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
if (Unit * charm = m_caster->GetCharm()) if (Unit * charm = m_caster->GetCharm())
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
@@ -2875,7 +2874,12 @@ void Spell::finish(bool ok)
} }
} }
} }
else if (m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isSummon())
// other code related only to successfully finished spells
if(!ok)
return;
if (m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isSummon())
{ {
// Unsummon statue // Unsummon statue
uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL); uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL);
@@ -2888,10 +2892,6 @@ void Spell::finish(bool ok)
} }
} }
// other code related only to successfully finished spells
if(!ok)
return;
//remove spell mods //remove spell mods
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellMods(this); ((Player*)m_caster)->RemoveSpellMods(this);