summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
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();