Core/Player: fix use after free crash

(cherry picked from commit d914c55c05)
This commit is contained in:
ariel-
2017-04-12 13:31:11 -03:00
committed by funjoker
parent fc0a037eef
commit 296abf3e12

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);
}
}