From 0f76143444a11cb60f07e22b359cd6d80b9b50c4 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 16 Feb 2022 16:12:30 +0800 Subject: [PATCH] Make VMap::find_nearest return -1 when empty (cherry picked from commit 3057b19daa3a9c2e6fbd1da97822e8c1f795dcdc) --- core/vmap.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/vmap.h b/core/vmap.h index 35548dc5cc9..8b9961fe0e0 100644 --- a/core/vmap.h +++ b/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); }