From 70d55097ee66ae5fe226f9554c32030a6fd59b7d Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 25 Oct 2024 20:15:12 +0300 Subject: [PATCH] client: Fix crash if note tree fails to find a child note --- src/public/app/widgets/note_tree.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index c79e79ea8..cefba22a2 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}`;