summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-08 23:18:03 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-08 23:18:03 +0300
commit7380aa6e86b51ef62530bea5d6f6f63244dffc4a (patch)
tree1b9915284b2b9c3e0969ae05f54a53adba72e527 /src/gui/windows/inventorywindow.cpp
parent7e66a4606bb15d98197f71245fe191d03152ee5f (diff)
downloadmanaplus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.tar.gz
manaplus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.tar.bz2
manaplus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.tar.xz
manaplus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.zip
Add some missing checks and remove useless checks.
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r--src/gui/windows/inventorywindow.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index e21299583..5c6ae3faa 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -572,28 +572,32 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
tradeWindow->isWindowVisible() &&
inputManager.isActionActive(InputAction::STOP_ATTACK));
- if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT)
+ if (mInventory)
{
- Item *const item = mItems->getSelectedItem();
+ if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT)
+ {
+ Item *const item = mItems->getSelectedItem();
- if (!item)
- return;
+ if (!item)
+ return;
- /* Convert relative to the window coordinates to absolute screen
- * coordinates.
- */
- const int mx = event.getX() + getX();
- const int my = event.getY() + getY();
+ /* Convert relative to the window coordinates to absolute screen
+ * coordinates.
+ */
+ const int mx = event.getX() + getX();
+ const int my = event.getY() + getY();
- if (popupMenu)
- popupMenu->showPopup(this, mx, my, item, mInventory->getType());
+ if (popupMenu)
+ popupMenu->showPopup(this, mx, my, item, mInventory->getType());
+ }
}
-
- if (!mInventory)
+ else
+ {
return;
+ }
- if (event.getButton() == MouseButton::LEFT
- || event.getButton() == MouseButton::RIGHT)
+ if (event.getButton() == MouseButton::LEFT ||
+ event.getButton() == MouseButton::RIGHT)
{
Item *const item = mItems->getSelectedItem();