소스 검색

Don't break when roster is not defined

JC Brand 9 년 전
부모
커밋
a4c4d6d2d3
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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')), {