Jelajahi Sumber

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

JC Brand 8 tahun lalu
induk
melakukan
b85b29bb20
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      src/converse-vcard.js

+ 2 - 2
src/converse-vcard.js

@@ -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,