diff --git a/src/index.ts b/src/index.ts index b061cea..392e15d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ function createNode(path: string[], tree: TreeNode[]) : void { if(path.length !== 0) { createNode(path, tree[tree.length -1].children) } - } else { + } else if(path.length !== 0) { createNode(path, tree[idx].children) } }