浏览代码

components/message: Add fallbacks if VCard is not defined

JC Brand 5 年之前
父节点
当前提交
cf2497656a
共有 1 个文件被更改,包括 2 次插入2 次删除
  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',