Browse Source

Updates #994. may not be defined

JC Brand 7 years ago
parent
commit
c012351df2
2 changed files with 9 additions and 5 deletions
  1. 1 0
      CHANGES.md
  2. 8 5
      src/converse-controlbox.js

+ 1 - 0
CHANGES.md

@@ -5,6 +5,7 @@
 ### Bugfixes
 
 - Could not register on Ejabberd 18. `"Missing attribute 'id' in tag qualified by namespace 'jabber:client'"`
+- #994 TypeError when using the `user.login` API.
 - #995 `ChildNode.replaceWith` is not available in Internet Explorer or Safari. Use `Node.replaceChild` instead.
 
 ## 3.3.1 (2018-01-18)

+ 8 - 5
src/converse-controlbox.js

@@ -115,11 +115,14 @@
 
             clearSession () {
                 this.__super__.clearSession.apply(this, arguments);
-                const controlbox = this.chatboxes.get('controlbox');
-                if (controlbox &&
-                        controlbox.collection &&
-                        controlbox.collection.browserStorage) {
-                    controlbox.save({'connected': false});
+                const chatboxes = _.get(this, 'chatboxes', null);
+                if (!_.isNil(chatboxes)) {
+                    const controlbox = chatboxes.get('controlbox');
+                    if (controlbox &&
+                            controlbox.collection &&
+                            controlbox.collection.browserStorage) {
+                        controlbox.save({'connected': false});
+                    }
                 }
             },