浏览代码

Merge pull request #58176 from timothyqiu/find-nearest

Rémi Verschelde 3 年之前
父节点
当前提交
f5b9cbaff6
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      core/templates/vmap.h

+ 3 - 0
core/templates/vmap.h

@@ -142,6 +142,9 @@ public:
 	}
 	}
 
 
 	int find_nearest(const T &p_val) const {
 	int find_nearest(const T &p_val) const {
+		if (_cowdata.is_empty()) {
+			return -1;
+		}
 		bool exact;
 		bool exact;
 		return _find(p_val, exact);
 		return _find(p_val, exact);
 	}
 	}