summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-01 20:20:03 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-01 20:20:03 +0300
commit9e1afaddd2059fa8aea418357eb3de6b4085c0bf (patch)
treec63a341e316668ec2c32995ba3f1e4b996dd006b
parentca49316628e8e3e6161d9a9649893664ef36c925 (diff)
downloadmv-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.tar.gz
mv-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.tar.bz2
mv-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.tar.xz
mv-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.zip
Fix crash in text fields if using context menu before connected to game.
-rw-r--r--src/gui/widgets/textfield.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index e47f1905f..a20b05e1e 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -707,9 +707,19 @@ void TextField::mousePressed(MouseEvent &event)
{
if (popupMenu)
{
- popupMenu->showTextFieldPopup(viewport->mMouseX,
- viewport->mMouseY,
- this);
+ if (viewport)
+ {
+ popupMenu->showTextFieldPopup(viewport->mMouseX,
+ viewport->mMouseY,
+ this);
+ }
+ else
+ {
+ int mouseX = 0;
+ int mouseY = 0;
+ Gui::getMouseState(&mouseX, &mouseY);
+ popupMenu->showTextFieldPopup(mouseX, mouseY, this);
+ }
}
}
else if (event.getButton() == MouseButton::LEFT)