Browse Source

Don't break when roster is not defined

JC Brand 9 năm trước cách đây
mục cha
commit
a4c4d6d2d3
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/converse-notification.js

+ 4 - 0
src/converse-notification.js

@@ -115,6 +115,10 @@
                 /* Shows an HTML5 Notification to indicate that a new chat
                  * message was received.
                  */
+                if (typeof converse.roster === 'undefined') {
+                    converse.log("Could not send notification, because roster is undefined", "error");
+                    return;
+                }
                 var contact_jid = Strophe.getBareJidFromJid($message.attr('from'));
                 var roster_item = converse.roster.get(contact_jid);
                 var n = new Notification(__(___("%1$s says"), roster_item.get('fullname')), {