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,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}`;