From 5b73fe949e2cb1232d96aa5868f1cab13a31d030 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 26 Aug 2022 22:08:05 +0200 Subject: [PATCH] defensive programming, #3089 --- src/routes/api/tree.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js index 95cd9d1c0..7874814c2 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,