From 73c9b3d01463e2ca143113ebca8d3a7e3b756256 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 16 Jan 2018 13:31:58 +0100 Subject: [FIX] mail: Cannot send new message from Event Track When the Speaker address is False, it crashed. opw:805361 --- addons/mail/static/src/js/utils.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'addons/mail/static/src/js/utils.js') diff --git a/addons/mail/static/src/js/utils.js b/addons/mail/static/src/js/utils.js index b4e0c01a23a..4c7619e393a 100644 --- a/addons/mail/static/src/js/utils.js +++ b/addons/mail/static/src/js/utils.js @@ -101,15 +101,17 @@ function inline (node, transform_children) { // Parses text to find email: Tagada -> [Tagada, address@mail.fr] or False function parse_email (text) { - var result = text.match(/(.*)<(.*@.*)>/); - if (result) { - return [_.str.trim(result[1]), _.str.trim(result[2])]; - } - result = text.match(/(.*@.*)/); - if (result) { - return [_.str.trim(result[1]), _.str.trim(result[1])]; + if (text){ + var result = text.match(/(.*)<(.*@.*)>/); + if (result) { + return [_.str.trim(result[1]), _.str.trim(result[2])]; + } + result = text.match(/(.*@.*)/); + if (result) { + return [_.str.trim(result[1]), _.str.trim(result[1])]; + } + return [text, false]; } - return [text, false]; } // Replaces textarea text into html text (add

, ) -- cgit v1.2.3