Commit 71ea60e4 authored by Guillermo Bonvehí's avatar Guillermo Bonvehí

Fixed an error that appears when unload event is triggered

This happens when you load a page with converse and do not login to
the chat. It can be tested in converse.org preserving logs while
navigating to another page.
Inside clearSession there's a call to roster which is not initalized
and also another one to controlbox.save which is not set so it fails
with an url error during sync.
parent c0bec459
...@@ -569,10 +569,13 @@ ...@@ -569,10 +569,13 @@
}; };
this.clearSession = function () { this.clearSession = function () {
this.roster.browserStorage._clear(); if (this.roster) {
this.roster.browserStorage._clear();
}
this.session.browserStorage._clear(); this.session.browserStorage._clear();
var controlbox = converse.chatboxes.get('controlbox'); if (converse.connection.connected) {
controlbox.save({'connected': false}); converse.chatboxes.get('controlbox').save({'connected': false});
}
}; };
this.setSession = function () { this.setSession = function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment