[fix #6087] error on empty messages

add a guard so that `right-to-left-text?` function doesn't throw
an error on empty content

future empty messages aren't going to pass validation

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2018-10-03 01:19:23 +02:00
parent 37c3f30d75
commit 23679ac5b4
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
1 changed files with 3 additions and 2 deletions

View File

@ -52,8 +52,9 @@
(def rtl-characters-regex #"[^\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]*?[\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]") (def rtl-characters-regex #"[^\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]*?[\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]")
(defn right-to-left-text? [content] (defn right-to-left-text? [content]
(let [char (first content)] (when-not (empty? content)
(re-matches rtl-characters-regex char))) (let [char (first content)]
(re-matches rtl-characters-regex char))))
(defview message-timestamp [t justify-timestamp? outgoing command? content] (defview message-timestamp [t justify-timestamp? outgoing command? content]
(when-not command? (when-not command?