Handle case were connection is not defined.

This commit is contained in:
JC Brand 2016-04-13 09:15:15 +00:00
parent aee232421c
commit 0564f0f592
2 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,7 @@
clearSession: function () {
this._super.clearSession.apply(this, arguments);
if (this.connection.connected) {
if (typeof this.connection !== 'undefined' && this.connection.connected) {
this.chatboxes.get('controlbox').save({'connected': false});
}
},

View File

@ -554,8 +554,10 @@
converse.auto_login = false;
converse.chatboxviews.closeAllChatBoxes();
converse.clearSession();
if (typeof converse.connection !== 'undefined') {
converse.connection.disconnect();
converse.connection.reset();
}
};
this.registerGlobalEventHandlers = function () {