Browse Source

components/message: Add fallbacks if VCard is not defined

JC Brand 5 years ago
parent
commit
cf2497656a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/components/message.js

+ 2 - 2
src/components/message.js

@@ -171,8 +171,8 @@ class Message extends CustomElement {
     }
 
     getAvatarData () {
-        const image_type = this.model.vcard.get('image_type');
-        const image_data = this.model.vcard.get('image');
+        const image_type = this.model.vcard?.get('image_type') || _converse.DEFAULT_IMAGE_TYPE;
+        const image_data = this.model.vcard?.get('image') || _converse.DEFAULT_IMAGE;
         const image = "data:" + image_type + ";base64," + image_data;
         return {
             'classes': 'chat-msg__avatar',