diff options
Diffstat (limited to 'addons/mail/static/src/js/utils.js')
| -rw-r--r-- | addons/mail/static/src/js/utils.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/addons/mail/static/src/js/utils.js b/addons/mail/static/src/js/utils.js index 6364be77eb5..49d1705eccd 100644 --- a/addons/mail/static/src/js/utils.js +++ b/addons/mail/static/src/js/utils.js @@ -100,15 +100,17 @@ function inline (node, transform_children) { // Parses text to find email: Tagada <address@mail.fr> -> [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 <p>, <a>) |
