summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/utils.js
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2018-01-16 13:31:58 +0100
committerGoffin Simon <sig@odoo.com>2018-01-16 15:58:41 +0100
commit73c9b3d01463e2ca143113ebca8d3a7e3b756256 (patch)
tree70a24e21191e107ec8b15f2c40491614cd556498 /addons/mail/static/src/js/utils.js
parent5e474bb3f91650efd184f32c7f4f23e555aee3ec (diff)
[FIX] mail: Cannot send new message from Event Track
When the Speaker address is False, it crashed. opw:805361
Diffstat (limited to 'addons/mail/static/src/js/utils.js')
-rw-r--r--addons/mail/static/src/js/utils.js18
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 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 <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>)