vcard: Bugfix. 'FN' may not be defined.

This commit is contained in:
JC Brand 2017-07-15 17:26:59 +02:00
parent e6492e286d
commit b85b29bb20

View File

@ -95,11 +95,11 @@
img = _.get(vcard.querySelector('BINVAL'), 'textContent'), img = _.get(vcard.querySelector('BINVAL'), 'textContent'),
url = _.get(vcard.querySelector('URL'), 'textContent'); url = _.get(vcard.querySelector('URL'), 'textContent');
let fullname = vcard.querySelector('FN').textContent; let fullname = _.get(vcard.querySelector('FN'), 'textContent');
if (jid) { if (jid) {
const contact = _converse.roster.get(jid); const contact = _converse.roster.get(jid);
if (contact) { if (contact) {
fullname = _.isEmpty(fullname) ? _.get(contact, 'fullname', jid) : fullname; fullname = _.isUndefined(fullname) ? _.get(contact, 'fullname', jid) : fullname;
contact.save({ contact.save({
'fullname': fullname, 'fullname': fullname,
'image_type': img_type, 'image_type': img_type,