summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)