diff --git a/src/converse-controlbox.js b/src/converse-controlbox.js index 4985ae0f7..8650126d4 100644 --- a/src/converse-controlbox.js +++ b/src/converse-controlbox.js @@ -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}); } }, diff --git a/src/converse-core.js b/src/converse-core.js index 462908346..59251ea06 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -554,8 +554,10 @@ converse.auto_login = false; converse.chatboxviews.closeAllChatBoxes(); converse.clearSession(); - converse.connection.disconnect(); - converse.connection.reset(); + if (typeof converse.connection !== 'undefined') { + converse.connection.disconnect(); + converse.connection.reset(); + } }; this.registerGlobalEventHandlers = function () {