From ce2e8867f35c02118d5a8496543571cf034280e0 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 6 Jan 2025 20:34:09 +0000 Subject: [PATCH] fix possible error when instance has no name --- scripts/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/index.js b/scripts/index.js index 0b75ef8..72ac419 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -348,6 +348,9 @@ async function populateInstances () { function sortInstances (criteria, searchQuery) { for (let i = 0; i < instances.length; i++) { + if (!instances[i].name) { // if the instance has no name, assume its just empty string + instances[i].name = ""; + } const { score, alignment } = criteria(instances[i].name.toLowerCase(), searchQuery ? searchQuery.toLowerCase() : ""); instances[i].searchQueryResult = { score, alignment }; }