summaryrefslogtreecommitdiff
path: root/core/templates
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-02-16 16:12:30 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-02-16 16:12:30 +0800
commit3057b19daa3a9c2e6fbd1da97822e8c1f795dcdc (patch)
treee56e34ca946d82e7114866c60c9f9aa4f0c6cf08 /core/templates
parent7989149b917c096af67a0566398bee4de83993ac (diff)
Make VMap::find_nearest return -1 when empty
Diffstat (limited to 'core/templates')
-rw-r--r--core/templates/vmap.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/templates/vmap.h b/core/templates/vmap.h
index 013c4e4262..37622258db 100644
--- a/core/templates/vmap.h
+++ b/core/templates/vmap.h
@@ -142,6 +142,9 @@ public:
}
int find_nearest(const T &p_val) const {
+ if (_cowdata.is_empty()) {
+ return -1;
+ }
bool exact;
return _find(p_val, exact);
}