aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-09-02 12:11:01 -0500
committermegamage <none@none>2009-09-02 12:11:01 -0500
commitc150629f8d9ef38a25e939354b931098517874cc (patch)
tree7ea998ed4f560d9aa1dc2dd73e9a8dedb0e06d6a /src
parentb0e15b8b23556aa44f30399526e6cbb86fc256e1 (diff)
*Fix a crash caused by spell target type channelled target. Thanks to nanouniko
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index f7593750ad7..5944dd08df3 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2140,7 +2140,8 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
switch(cur)
{
case TARGET_UNIT_CHANNEL:
- if(Unit* target = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTarget())
+ // in some cases unittarget is invalid and crash. do not know why it happens.
+ if(Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID()))
AddUnitTarget(target, i);
else
sLog.outError( "SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id );
@@ -2148,7 +2149,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_DEST_CHANNEL:
if(m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.HasDst())
m_targets = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets;
- else if(Unit* target = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTarget())
+ else if(Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID()))
m_targets.setDst(target);
else
sLog.outError( "SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id );