summaryrefslogtreecommitdiff
path: root/scene/gui/item_list.cpp
diff options
context:
space:
mode:
authorCameron Reikes <cameronreikes@gmail.com>2019-07-05 22:14:49 -0700
committerCameron Reikes <cameronreikes@gmail.com>2019-07-05 22:14:49 -0700
commit597e6e1bd9bec44699a5dc4dfb87f96b5d8e055e (patch)
tree7133cd21bf7bd7c1f379515603f0d4716b318186 /scene/gui/item_list.cpp
parentd897131ac555de84afe9ca6845abf87c26957895 (diff)
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.
Diffstat (limited to 'scene/gui/item_list.cpp')
-rw-r--r--scene/gui/item_list.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 91b76839d7..a3bc68ffcd 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -754,7 +754,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &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;