From a884f3e444ad64ffdc33c9b5a033a97ff683a799 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 8 Sep 2014 14:09:21 +0000 Subject: [PATCH] Fix error "cannot read property of undefiend of indexOf" in mail expand on click --- mail/js/app.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 12e0e77f42..8c9a3eb3b1 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -667,16 +667,19 @@ app.classes.mail = AppJS.extend( for(var i = 0; i < content.length; i++) { // if there is no @ in string, its most likely that we have a comma in the personal name part of the emailaddress - if (content[i].indexOf('@')<0) - { - remembervalue = content[i]; - } - else - { - var value = remembervalue+(remembervalue?',':'')+content[i]; - var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); - email.loadingFinished(); - remembervalue = ''; + if (content[i] != 'undefined' && content[i]) + { + if (content[i].indexOf('@')< 0) + { + remembervalue = content[i]; + } + else + { + var value = remembervalue+(remembervalue?',':'')+content[i]; + var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); + email.loadingFinished(); + remembervalue = ''; + } } } }