Make VMap::find_nearest return -1 when empty

This commit is contained in:
Haoyu Qiu 2022-02-16 16:12:30 +08:00
parent 7989149b91
commit 3057b19daa

View file

@ -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);
} }