summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 7e9049aa0..17c0d9cf1 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -616,18 +616,21 @@ void ItemContainer::mouseReleased(MouseEvent &event)
#endif
{
inventory = PlayerInfo::getInventory();
- const Item *const item = inventory->getItem(dragDrop.getTag());
- if (item && !PlayerInfo::isItemProtected(item->getId()))
+ if (inventory)
{
- mInventory->addItem(item->getId(), item->getType(),
- 1,
- 1,
- item->getColor(),
- item->getIdentified(),
- item->getDamaged(),
- item->getFavorite(),
- Equipm_false,
- Equipped_false);
+ const Item *const item = inventory->getItem(dragDrop.getTag());
+ if (item && !PlayerInfo::isItemProtected(item->getId()))
+ {
+ mInventory->addItem(item->getId(), item->getType(),
+ 1,
+ 1,
+ item->getColor(),
+ item->getIdentified(),
+ item->getDamaged(),
+ item->getFavorite(),
+ Equipm_false,
+ Equipped_false);
+ }
}
return;
}
@@ -638,9 +641,12 @@ void ItemContainer::mouseReleased(MouseEvent &event)
#endif
{
inventory = PlayerInfo::getInventory();
- const Item *const item = inventory->getItem(dragDrop.getTag());
- if (item)
- mInventory->removeItemAt(dragDrop.getTag());
+ if (inventory)
+ {
+ const Item *const item = inventory->getItem(dragDrop.getTag());
+ if (item)
+ mInventory->removeItemAt(dragDrop.getTag());
+ }
return;
}