diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-01 20:20:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-01 20:20:03 +0300 |
commit | 9e1afaddd2059fa8aea418357eb3de6b4085c0bf (patch) | |
tree | c63a341e316668ec2c32995ba3f1e4b996dd006b /src/gui/widgets | |
parent | ca49316628e8e3e6161d9a9649893664ef36c925 (diff) | |
download | manaverse-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.tar.gz manaverse-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.tar.bz2 manaverse-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.tar.xz manaverse-9e1afaddd2059fa8aea418357eb3de6b4085c0bf.zip |
Fix crash in text fields if using context menu before connected to game.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/textfield.cpp | 16 |
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) |