Fix crash when pressing up on an empty PopupMenu

This commit is contained in:
Michael Alexsander 2022-08-27 18:26:31 -03:00 committed by Relintai
parent 92bc8ed3be
commit 7fd1e3b8ac

View File

@ -243,6 +243,7 @@ void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!items.empty()) {
if (p_event->is_action("ui_down") && p_event->is_pressed()) {
int search_from = mouse_over + 1;
if (search_from >= items.size()) {
@ -332,6 +333,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
accept_event();
}
}
}
Ref<InputEventMouseButton> b = p_event;