diff --git a/src/utils/tree.ts b/src/utils/tree.ts index 91059ef91e6c0029235a8e3b5d92cd8293632fb2..e5db503f83b828ac811e164c2c18a38bb172ebe4 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -376,6 +376,9 @@ export const treeToString = (tree: any[], nodeId) => { let str = '' function performAThoroughValidation(arr) { + if (typeof arr === 'undefined' || !Array.isArray(arr) || arr.length === 0) { + return false + } for (const item of arr) { if (item.id === nodeId) { str += ` / ${item.name}`