diff --git a/src/routes/api/note_map.js b/src/routes/api/note_map.js index 4458797a9..9ec95851c 100644 --- a/src/routes/api/note_map.js +++ b/src/routes/api/note_map.js @@ -213,7 +213,7 @@ function findExcerpts(sourceNote, referencedNoteId) { let centerEl = linkEl; - while (centerEl.tagName !== 'BODY' && centerEl.parentElement.textContent.length <= EXCERPT_CHAR_LIMIT) { + while (centerEl.tagName !== 'BODY' && centerEl.parentElement?.textContent?.length <= EXCERPT_CHAR_LIMIT) { centerEl = centerEl.parentElement; }