소스 검색

Make VMap::find_nearest return -1 when empty

(cherry picked from commit 3057b19daa3a9c2e6fbd1da97822e8c1f795dcdc)
Haoyu Qiu 3 년 전
부모
커밋
0f76143444
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      core/vmap.h

+ 3 - 0
core/vmap.h

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