浏览代码

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.
Cameron Reikes 6 年之前
父节点
当前提交
597e6e1bd9
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      scene/gui/item_list.cpp

+ 1 - 1
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;