Skip to content

Build your personal knowledge base with Trilium Notes

defensive programming, #3089

zadam5b73fe949e2c
diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js
index 95cd9d1c0a..7874814c20 100644
--- a/src/routes/api/tree.js
+++ b/src/routes/api/tree.js
@@ -97,6 +97,11 @@ function getNotesAndBranchesAndAttributes(noteIds) {
for (const attributeId of collectedAttributeIds) {
const attribute = becca.attributes[attributeId];
+ if (!attribute) {
+ log.error(`Could not find attribute for attributeId=${attributeId}`);
+ continue;
+ }
+
attributes.push({
attributeId: attribute.attributeId,
noteId: attribute.noteId,