fix: isNoteEmpty causing crashes

This commit is contained in:
thecodrr
2020-04-16 12:23:31 +05:00
parent cc3e7cfb8e
commit 47d01235ed

View File

@@ -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;
}