From dbdc2db5f7e6d4e461b05253ee99d79bbacb7c2f Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 19 Jun 2009 10:15:08 -0500 Subject: *Fix a crash caused by ~item. --HG-- branch : trunk --- src/game/Bag.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index 98870b915eb..2d58b63c0a9 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -39,8 +39,17 @@ Bag::Bag( ): Item() Bag::~Bag() { for(uint8 i = 0; i < MAX_BAG_SIZE; ++i) - if (m_bagslot[i]) + if (Item *item = m_bagslot[i]) + { + if(item->IsInWorld()) + { + sLog.outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", + item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(), + GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i); + item->RemoveFromWorld(); + } delete m_bagslot[i]; + } } void Bag::AddToWorld() -- cgit v1.2.3