From 94347442196f88e6d80c195fc1eb66c323e9f4f3 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 26 Oct 2023 16:54:43 +0200 Subject: [PATCH] Fix filter data crashing when data contains non string values It may happen when data comes from an import. fix #1377 --- umap/static/umap/js/umap.features.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index 5b3b8f7b..aa7eda67 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -478,8 +478,9 @@ L.U.FeatureMixin = { matchFilter: function (filter, keys) { filter = filter.toLowerCase() - for (let i = 0; i < keys.length; i++) { - if ((this.properties[keys[i]] || '').toLowerCase().indexOf(filter) !== -1) + for (let i = 0, value; i < keys.length; i++) { + value = (this.properties[keys[i]] || '') + '' + if (value.toLowerCase().indexOf(filter) !== -1) return true } return false