Core/Player: fix use after free crash

(cherry picked from commit d914c55c0585fe31a9a1b9fe4e9d4a9b498e8e8f)
This commit is contained in:
ariel-
2020-04-27 12:25:52 +02:00
committed by funjoker
parent fc0a037eef
commit 296abf3e12
+2 -1
View File
@@ -13875,10 +13875,11 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del)
pItem->RemoveFromWorld();
if (del)
{
pItem->SetState(ITEM_REMOVED, this);
if (ItemTemplate const* itemTemplate = pItem->GetTemplate())
if (itemTemplate->GetFlags() & ITEM_FLAG_HAS_LOOT)
sLootItemStorage->RemoveStoredLootForContainer(pItem->GetGUID().GetCounter());
pItem->SetState(ITEM_REMOVED, this);
}
}