1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3584 from Steve-Mcl/fix-search-err

Fix browser console error Uncaught TypeError when searching certain terms
This commit is contained in:
Stephen McLaughlin 2022-05-05 08:14:26 +01:00 committed by GitHub
commit 7484dc5b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,7 @@ RED.search = (function() {
var key = keys[i]; var key = keys[i];
var kpos = keys[i].indexOf(val); var kpos = keys[i].indexOf(val);
if (kpos > -1) { if (kpos > -1) {
var ids = Object.keys(index[key]); var ids = Object.keys(index[key]||{});
for (j=0;j<ids.length;j++) { for (j=0;j<ids.length;j++) {
var node = index[key][ids[j]]; var node = index[key][ids[j]];
var isConfigNode = node.node._def.category === "config" && node.node.type !== 'group'; var isConfigNode = node.node._def.category === "config" && node.node.type !== 'group';
@ -255,7 +255,7 @@ RED.search = (function() {
} }
currentResults = search(value); currentResults = search(value);
if (currentResults.length > 0) { if (currentResults.length > 0) {
for (i=0;i<Math.min(currentResults.length,25);i++) { for (let i=0;i<Math.min(currentResults.length,25);i++) {
searchResults.editableList('addItem',currentResults[i]) searchResults.editableList('addItem',currentResults[i])
} }
if (currentResults.length > 25) { if (currentResults.length > 25) {