From 8d2dab109352f254fb36251232a42c60f3a1b05e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 5 Jul 2009 13:56:31 +0400 Subject: [PATCH] [8119] Speedup code and prevent crash at pet stats reset in time owner not in world. --- src/game/Pet.cpp | 13 ++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 2f9cbfdba..32964c818 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1459,13 +1459,16 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab) { if(removeSpell(spell_id,learn_prev,clear_ab)) { - if(GetOwner()->GetTypeId() == TYPEID_PLAYER) + if(!m_loading) { - if(!m_loading) + if (Unit* owner = GetOwner()) { - WorldPacket data(SMSG_PET_REMOVED_SPELL, 4); - data << uint32(spell_id); - ((Player*)GetOwner())->GetSession()->SendPacket(&data); + if(owner->GetTypeId() == TYPEID_PLAYER) + { + WorldPacket data(SMSG_PET_REMOVED_SPELL, 4); + data << uint32(spell_id); + ((Player*)owner)->GetSession()->SendPacket(&data); + } } } return true; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4312804a9..97cd30eb6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8118" + #define REVISION_NR "8119" #endif // __REVISION_NR_H__