From 995410c475efa13e4b021b1df9f27d8e66fedd23 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 19 Apr 2009 14:35:55 -0500 Subject: *Fix a crash caused by farsight spells. --HG-- branch : trunk --- src/game/ObjectAccessor.cpp | 10 ++++++---- src/game/SpellAuras.cpp | 30 ++++++++++-------------------- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 7daf7e5395e..4df45812f7f 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -514,11 +514,13 @@ ObjectAccessor::WorldObjectChangeAccumulator::Visit(DynamicObjectMapType &m) { for(DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID())) + uint64 guid = iter->getSource()->GetCasterGUID(); + if(IS_PLAYER_GUID(guid)) { - Player* caster = (Player*)iter->getSource()->GetCaster(); - if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID()) - BuildPacket(caster); + //Caster may be NULL if DynObj is in removelist + if(Player *caster = FindPlayer(guid)) + if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID()) + BuildPacket(caster); } } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 8f14fb5e5ef..851ad35c0f9 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1264,8 +1264,7 @@ void Aura::DropAuraCharge() { if(m_procCharges) //auras without charges always have charge = 0 { - --m_procCharges; - if(m_procCharges) // Send charge change + if(--m_procCharges) // Send charge change SendAuraUpdate(); else // Last charge dropped m_target->RemoveAura(this); @@ -1274,39 +1273,30 @@ void Aura::DropAuraCharge() bool Aura::IsPersistent() const { - for (uint8 i=0; iIsPersistent()) - return true; - } + if(m_partAuras[i] && m_partAuras[i]->IsPersistent()) + return true; } return false; } bool Aura::IsAreaAura() const { - for (uint8 i=0; iIsAreaAura()) - return true; - } + if(m_partAuras[i] && m_partAuras[i]->IsAreaAura()) + return true; } return false; } bool Aura::IsAuraType(AuraType type) const { - for (uint8 i=0; iGetAuraName()==type) - return true; - } + if(m_partAuras[i] && m_partAuras[i]->GetAuraName() == type) + return true; } return false; } -- cgit v1.2.3