浏览代码

Merge pull request #49925 from RicardRC/FindFromNop

Make use of variable "from" in local_vector find() function.
Rémi Verschelde 4 年之前
父节点
当前提交
7f9346b81b
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      core/templates/local_vector.h

+ 2 - 1
core/templates/local_vector.h

@@ -178,7 +178,8 @@ public:
 	}
 	}
 
 
 	int64_t find(const T &p_val, U p_from = 0) const {
 	int64_t find(const T &p_val, U p_from = 0) const {
-		for (U i = 0; i < count; i++) {
+		ERR_FAIL_UNSIGNED_INDEX_V(p_from, count, -1);
+		for (U i = p_from; i < count; i++) {
 			if (data[i] == p_val) {
 			if (data[i] == p_val) {
 				return int64_t(i);
 				return int64_t(i);
 			}
 			}