Skip to content

Build your personal knowledge base with Trilium Notes

fix potential null in mime or type in note cache

zadam918e827d910c
diff --git a/src/services/search/expressions/note_cache_flat_text.js b/src/services/search/expressions/note_cache_flat_text.js
index bbb5cbcea3..024c5f5be2 100644
--- a/src/services/search/expressions/note_cache_flat_text.js
+++ b/src/services/search/expressions/note_cache_flat_text.js
@@ -84,7 +84,9 @@ class NoteCacheFlatTextExp extends Expression {
const foundAttrTokens = [];
for (const token of this.tokens) {
- if (note.type.includes(token) || note.mime.includes(token)) {
+ // not clear why, but sometimes note.type or note.mime is undefined
+ if ((note.type && note.type.includes(token))
+ || (note.mime && note.mime.includes(token))) {
foundAttrTokens.push(token);
}