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

This commit is contained in:
Elian Doran 2024-10-25 20:15:12 +03:00
parent 560467bdba
commit 70d55097ee
No known key found for this signature in database

View File

@ -666,9 +666,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
} }
const node = this.prepareNode(branch); const node = this.prepareNode(branch);
if (node) {
noteList.push(node); noteList.push(node);
} }
}
return noteList; return noteList;
} }
@ -709,7 +710,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const note = branch.getNoteFromCache(); const note = branch.getNoteFromCache();
if (!note) { 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}`; const title = `${branch.prefix ? (`${branch.prefix} - `) : ""}${note.title}`;