diff options
author | Kahrl <kahrl@gmx.net> | 2013-11-23 00:30:16 +0100 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2013-11-23 00:37:32 +0100 |
commit | 6f851c969251895efc3c3f02650456a2eac05d95 (patch) | |
tree | baeb9c20da4c4490af09756cb0cc5f94841953dd | |
parent | e52d811110392e864332fb1a463a19983553087f (diff) | |
download | minetest-6f851c969251895efc3c3f02650456a2eac05d95.tar.gz minetest-6f851c969251895efc3c3f02650456a2eac05d95.tar.bz2 minetest-6f851c969251895efc3c3f02650456a2eac05d95.zip |
Fix crash when pressing Enter key in formspec menu
-rw-r--r-- | src/guiFormSpecMenu.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 2416e4c8a..8ffddcbc6 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -2297,12 +2297,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) switch (event.KeyInput.Key) { case KEY_RETURN: - if (m_allowclose) { - acceptInput(true); - quitMenu(); - } - else - current_keys_pending.key_enter = true; + current_keys_pending.key_enter = true; break; case KEY_UP: current_keys_pending.key_up = true; @@ -2316,7 +2311,13 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) assert("reached a source line that can't ever been reached" == 0); break; } - acceptInput(); + if (current_keys_pending.key_enter && m_allowclose) { + acceptInput(true); + quitMenu(); + } + else { + acceptInput(); + } return true; } |