Protection against empty menus
This commit is contained in:
+3
-1
@@ -65,7 +65,9 @@ void MenuBody::onEvent(event_t event)
|
|||||||
bool MenuBody::onTouchEnd(coord_t /*x*/, coord_t y)
|
bool MenuBody::onTouchEnd(coord_t /*x*/, coord_t y)
|
||||||
{
|
{
|
||||||
int index = y / MENUS_LINE_HEIGHT;
|
int index = y / MENUS_LINE_HEIGHT;
|
||||||
lines[index].onPress();
|
if (index < lines.size()) {
|
||||||
|
lines[index].onPress();
|
||||||
|
}
|
||||||
getParent()->getParent()->deleteLater();
|
getParent()->getParent()->deleteLater();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user