From e742916084a722fdeca8fb1420416292b1de5e79 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 20 Jul 2016 11:02:50 -0400 Subject: [PATCH] (js) Improve check on undefined email of card --- UI/WebServerResources/js/Contacts/Card.service.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/UI/WebServerResources/js/Contacts/Card.service.js b/UI/WebServerResources/js/Contacts/Card.service.js index 61b9bbf61..09acffaf8 100644 --- a/UI/WebServerResources/js/Contacts/Card.service.js +++ b/UI/WebServerResources/js/Contacts/Card.service.js @@ -246,7 +246,7 @@ }; Card.prototype.$fullname = function(options) { - var fn = this.c_cn || '', html = options && options.html, names; + var fn = this.c_cn || '', html = options && options.html, email, names; if (fn.length === 0) { names = []; if (this.c_givenname && this.c_givenname.length > 0) @@ -261,10 +261,9 @@ fn = this.c_org; } else if (this.emails && this.emails.length > 0) { - fn = _.find(this.emails, function(i) { return i.value !== ''; }).value; - } - else if (this.c_cn && this.c_cn.length > 0) { - fn = this.c_cn; + email = _.find(this.emails, function(i) { return i.value !== ''; }); + if (email) + fn = email.value; } }