aboutsummaryrefslogtreecommitdiff
path: root/src/game/Bag.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-19 10:15:08 -0500
committermegamage <none@none>2009-06-19 10:15:08 -0500
commitdbdc2db5f7e6d4e461b05253ee99d79bbacb7c2f (patch)
treea5fd26aefc283142879f322c8a41b57b5ae0bad3 /src/game/Bag.cpp
parent88137c07b932ab5199c79a1d4f9d6246dac21e9e (diff)
*Fix a crash caused by ~item.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Bag.cpp')
-rw-r--r--src/game/Bag.cpp11
1 files changed, 10 insertions, 1 deletions
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()