From 7380aa6e86b51ef62530bea5d6f6f63244dffc4a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Feb 2016 23:18:03 +0300 Subject: Add some missing checks and remove useless checks. --- src/gui/windows/inventorywindow.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/gui/windows/inventorywindow.cpp') 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(); -- cgit v1.2.3-60-g2f50