Commit bf611228 authored by JC Brand's avatar JC Brand

Avoid trying to retrieve non-existing models. fixes #415

parent e3f20bf1
...@@ -3411,17 +3411,19 @@ ...@@ -3411,17 +3411,19 @@
}, },
closeAllChatBoxes: function (include_controlbox) { closeAllChatBoxes: function (include_controlbox) {
var i, chatbox;
// TODO: once Backbone.Overview has been refactored, we should // TODO: once Backbone.Overview has been refactored, we should
// be able to call .each on the views themselves. // be able to call .each on the views themselves.
this.model.each($.proxy(function (model) { var ids = [];
this.model.each(function (model) {
var id = model.get('id'); var id = model.get('id');
if (include_controlbox || id !== 'controlbox') { if (include_controlbox || id !== 'controlbox') {
if (this.get(id)) { // Should always resolve, but shit happens ids.push(id);
this.get(id).close();
}
} }
}, this)); });
ids.forEach(function(id) {
var chatbox = this.get(id);
if (chatbox) { chatbox.close(); }
}, this);
return this; return this;
}, },
......
...@@ -9,6 +9,7 @@ Changelog ...@@ -9,6 +9,7 @@ Changelog
* Bugfix. clearSessions during unload event would throw an error when not logged in. [gbonvehi] * Bugfix. clearSessions during unload event would throw an error when not logged in. [gbonvehi]
* Bugfix. wrong callback argument mapping in XmppStatus initialize: fullname is null [thierrytiti] * Bugfix. wrong callback argument mapping in XmppStatus initialize: fullname is null [thierrytiti]
* #389 Allow login panel placeholders and roster item 'Name' translations. [gbonvehi] * #389 Allow login panel placeholders and roster item 'Name' translations. [gbonvehi]
* #415 closeAllChatBoxes is giving ReferenceError when 2 chats are open [nevcos, jcbrand]
* Add placeholder for "Insert a smiley" translation [thierrytiti] * Add placeholder for "Insert a smiley" translation [thierrytiti]
* Updated French translation [thierrytiti] * Updated French translation [thierrytiti]
* CSS fix: position and width of the div #conversejs [thierrytiti] * CSS fix: position and width of the div #conversejs [thierrytiti]
......
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