From 47d01235eda93f54b9e02ba87d202f46fefba6a5 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Thu, 16 Apr 2020 12:23:31 +0500 Subject: [PATCH] fix: isNoteEmpty causing crashes --- packages/core/collections/notes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js index 0277decc5..c24047906 100644 --- a/packages/core/collections/notes.js +++ b/packages/core/collections/notes.js @@ -225,7 +225,9 @@ function isNoteEmpty(note) { locked, } = note; const isTitleEmpty = !title || !title.trim().length; - const isTextEmpty = !isHex(text) && (!text || !text.trim().length); + let textLength = + text.data != null ? text.data.trim().length : text.trim().length; + const isTextEmpty = !isHex(text) && (!text || !textLength); const isDeltaEmpty = !isHex(delta) && (!delta || !delta.ops); return !locked && isTitleEmpty && isTextEmpty && isDeltaEmpty; }