Skip to content

Build your personal knowledge base with Trilium Notes

make encryption more robust in face of null values, #1483

zadam7133e60267be
diff --git a/src/services/protected_session.js b/src/services/protected_session.js
index ebf4b998f1..f224ed6f17 100644
--- a/src/services/protected_session.js
+++ b/src/services/protected_session.js
@@ -43,10 +43,18 @@ function decryptNotes(notes) {
}
function encrypt(plainText) {
+ if (plainText === null) {
+ return null;
+ }
+
return dataEncryptionService.encrypt(getDataKey(), plainText);
}
function decrypt(cipherText) {
+ if (cipherText === null) {
+ return null;
+ }
+
return dataEncryptionService.decrypt(getDataKey(), cipherText);
}