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);
|
select(selectedIndex == 0 ? lines.size() - 1 : selectedIndex - 1);
|
||||||
}
|
}
|
||||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
Window::onEvent(event); // the window above will be closed on event
|
if (selectedIndex < 0) {
|
||||||
lines[selectedIndex].onPress();
|
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)) {
|
else if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||||
if (onCancel)
|
if (onCancel)
|
||||||
|
|||||||
Reference in New Issue
Block a user