From 8905148dbcdf0118078a880e295563023ac20783 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 27 May 2022 21:55:58 +0200 Subject: [PATCH] fix NPE in note map, closes #2877 --- src/routes/api/note_map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }