Crash when pressing [ENTER] in a menu when nothing is selected
This commit is contained in:
+7
-2
@@ -42,8 +42,13 @@ void MenuBody::onEvent(event_t event)
|
||||
select(selectedIndex == 0 ? lines.size() - 1 : selectedIndex - 1);
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
Window::onEvent(event); // the window above will be closed on event
|
||||
lines[selectedIndex].onPress();
|
||||
if (selectedIndex < 0) {
|
||||
select(0);
|
||||
}
|
||||
else {
|
||||
Window::onEvent(event); // the window above will be closed on event
|
||||
lines[selectedIndex].onPress();
|
||||
}
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
if (onCancel)
|
||||
|
||||
Reference in New Issue
Block a user