summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-07 19:27:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-07 19:27:10 +0300
commit249d59d10905f46ee91683d08386c7bc9936bc4b (patch)
tree5ef78f3585320b3e51d0680a68773a26b320081d
parentef190a13443d1ae9522c98ac5fab5a8c6181cda1 (diff)
downloadmanaplus-249d59d10905f46ee91683d08386c7bc9936bc4b.tar.gz
manaplus-249d59d10905f46ee91683d08386c7bc9936bc4b.tar.bz2
manaplus-249d59d10905f46ee91683d08386c7bc9936bc4b.tar.xz
manaplus-249d59d10905f46ee91683d08386c7bc9936bc4b.zip
fix crash in windows before game started.
-rw-r--r--src/gui/widgets/window.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index f8622bb20..dd7627b23 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -769,9 +769,22 @@ void Window::mousePressed(MouseEvent &event)
if (popupMenu)
{
event.consume();
- popupMenu->showWindowPopup(this,
- viewport->mMouseX,
- viewport->mMouseY);
+
+ if (viewport)
+ {
+ popupMenu->showWindowPopup(this,
+ viewport->mMouseX,
+ viewport->mMouseY);
+ }
+ else
+ {
+ int mouseX = 0;
+ int mouseY = 0;
+ Gui::getMouseState(&mouseX, &mouseY);
+ popupMenu->showWindowPopup(this,
+ mouseX,
+ mouseY);
+ }
}
}
}