Skip to content

Build your personal knowledge base with Trilium Notes

client: Fix crash if note tree fails to find a child note

Elian Doran70d55097ee66
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index c79e79ea81..cefba22a26 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -666,8 +666,9 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
}
const node = this.prepareNode(branch);
-
- noteList.push(node);
+ if (node) {
+ noteList.push(node);
+ }
}
return noteList;
@@ -709,7 +710,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const note = branch.getNoteFromCache();
if (!note) {
- throw new Error(`Branch '${branch.branchId}' has no child note '${branch.noteId}'`);
+ console.warn(`Branch '${branch.branchId}' has no child note '${branch.noteId}'`);
+ return null;
}
const title = `${branch.prefix ? (`${branch.prefix} - `) : ""}${note.title}`;