Skip to content

Build your personal knowledge base with Trilium Notes

fix NPE in note map, closes #2877

zadam8905148dbcdf
diff --git a/src/routes/api/note_map.js b/src/routes/api/note_map.js
index 4458797a9b..9ec95851c0 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;
}