summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemcontainer.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 650911f9d..975b865d9 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -789,9 +789,13 @@ void ItemContainer::mouseReleased(MouseEvent &event)
inventory = PlayerInfo::getInventory();
if (inventory)
{
- mInventory->addVirtualItem(
- inventory->getItem(dragDrop.getTag()),
- getSlotByXY(event.getX(), event.getY()));
+ Item *const item = inventory->getItem(dragDrop.getTag());
+ if (mInventory->addVirtualItem(
+ item,
+ getSlotByXY(event.getX(), event.getY())))
+ {
+ inventory->virtualRemove(item, 1);
+ }
}
return;
}