fix possible error when instance has no name

This commit is contained in:
Arthur Lu 2025-01-06 20:34:09 +00:00
parent 2170077522
commit ce2e8867f3

View File

@ -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 };
}