Browse Source

profile: optional chaining for model.vcard

JC Brand 4 years ago
parent
commit
5149e4000d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/converse-profile.js

+ 2 - 2
src/converse-profile.js

@@ -192,9 +192,9 @@ converse.plugins.add('converse-profile', {
                 const chat_status = this.model.get('status') || 'offline';
                 return tpl_profile(Object.assign(
                     this.model.toJSON(),
-                    this.model.vcard.toJSON(), {
+                    this.model.vcard?.toJSON() ?? {}, {
                     chat_status,
-                    'fullname': this.model.vcard.get('fullname') || _converse.bare_jid,
+                    'fullname': this.model.vcard?.get('fullname') || _converse.bare_jid,
                     "showUserSettingsModal": ev => this.showUserSettingsModal(ev),
                     'status_message': this.model.get('status_message') ||
                                         __("I am %1$s", this.getPrettyStatus(chat_status)),