summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-16 11:01:13 +0100
committerGitHub <noreply@github.com>2022-02-16 11:01:13 +0100
commitf5b9cbaff6f0a058d08187b3124948ae68848cd0 (patch)
tree621cb55edb01846f9fcaf49cb5f685881ad2c761 /core
parenta269e78344d8f58696c43b397aa5b70ff864e1aa (diff)
parent3057b19daa3a9c2e6fbd1da97822e8c1f795dcdc (diff)
Merge pull request #58176 from timothyqiu/find-nearest
Diffstat (limited to 'core')
-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);
}