From 597e6e1bd9bec44699a5dc4dfb87f96b5d8e055e Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Fri, 5 Jul 2019 22:14:49 -0700 Subject: [PATCH] Give up finding item if started at beginning When the current item is -1, then the loop will infinitely repeat, constantly setting i to zero and never exiting. --- scene/gui/item_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 91b76839d77..a3bc68ffcd6 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -754,7 +754,7 @@ void ItemList::_gui_input(const Ref &p_event) { for (int i = current + 1; i <= items.size(); i++) { if (i == items.size()) { - if (current == 0) + if (current == 0 || current == -1) break; else i = 0;