[11492] Fix possible crash at guardian pet unsummon

This commit is contained in:
zergtmn 2011-05-16 01:19:50 +06:00 committed by zerg
parent 55cc1ea37f
commit 05cfb8d36b
2 changed files with 5 additions and 3 deletions

View file

@ -5962,10 +5962,12 @@ void Unit::RemoveGuardians()
{ {
while (!m_guardianPets.empty()) while (!m_guardianPets.empty())
{ {
if (Pet* pet = GetMap()->GetPet(*m_guardianPets.begin())) ObjectGuid guid = *m_guardianPets.begin();
if (Pet* pet = GetMap()->GetPet(guid))
pet->Unsummon(PET_SAVE_AS_DELETED, this); pet->Unsummon(PET_SAVE_AS_DELETED, this);
m_guardianPets.erase(m_guardianPets.begin()); m_guardianPets.erase(guid);
} }
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11491" #define REVISION_NR "11492"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__