From 249d59d10905f46ee91683d08386c7bc9936bc4b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Sep 2014 19:27:10 +0300 Subject: fix crash in windows before game started. --- src/gui/widgets/window.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/gui') 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); + } } } } -- cgit v1.2.3-70-g09d2