Skip to content

Commit

Permalink
Fix crash when pressing Enter key in formspec menu
Browse files Browse the repository at this point in the history
  • Loading branch information
kahrl committed Nov 22, 2013
1 parent e52d811 commit 6f851c9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/guiFormSpecMenu.cpp
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 6f851c9

Please sign in to comment.