Fix crash when pressing up on an empty PopupMenu
This commit is contained in:
parent
5beec641b6
commit
f0d380c9fd
1 changed files with 64 additions and 62 deletions
|
@ -223,6 +223,7 @@ void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
|
||||||
void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
ERR_FAIL_COND(p_event.is_null());
|
ERR_FAIL_COND(p_event.is_null());
|
||||||
|
|
||||||
|
if (!items.empty()) {
|
||||||
if (p_event->is_action("ui_down") && p_event->is_pressed()) {
|
if (p_event->is_action("ui_down") && p_event->is_pressed()) {
|
||||||
int search_from = mouse_over + 1;
|
int search_from = mouse_over + 1;
|
||||||
if (search_from >= items.size()) {
|
if (search_from >= items.size()) {
|
||||||
|
@ -312,6 +313,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
accept_event();
|
accept_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> b = p_event;
|
Ref<InputEventMouseButton> b = p_event;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue