diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-11 00:12:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-11 00:12:09 +0300 |
commit | 4fbb944f132eb886a6f5b350e5a14a4fe380aacf (patch) | |
tree | 6df2ed96430610ee7c35a7ca4902bbdade0e8e34 /src/gui/widgets/itemcontainer.cpp | |
parent | 1dc012a3bb44218778568e8f80c4e9b445802195 (diff) | |
download | manaverse-4fbb944f132eb886a6f5b350e5a14a4fe380aacf.tar.gz manaverse-4fbb944f132eb886a6f5b350e5a14a4fe380aacf.tar.bz2 manaverse-4fbb944f132eb886a6f5b350e5a14a4fe380aacf.tar.xz manaverse-4fbb944f132eb886a6f5b350e5a14a4fe380aacf.zip |
Add missing checks into gui.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 34 |
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; } |