From 3057b19daa3a9c2e6fbd1da97822e8c1f795dcdc Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 16 Feb 2022 16:12:30 +0800 Subject: Make VMap::find_nearest return -1 when empty --- core/templates/vmap.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core') 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); } -- cgit v1.2.3