Commit 72f47d26bfe24203077e172672d21fff7a652a91

Authored by OpenWapp Developer
1 parent e376f9809b

Fixing an iteration over a collection being modified

Showing 2 changed files with 4 additions and 4 deletions

app/scripts/collections/history.js View file @ 72f47d2
... ... @@ -406,9 +406,9 @@
406 406 var contact = conversation.get('contact');
407 407  
408 408 var messages = conversation ? conversation.get('messages') : [];
409   - messages.forEach(function (message) {
410   - messages.remove(message);
411   - });
  409 + while (messages.length > 0) {
  410 + messages.remove(messages.at(0));
  411 + };
412 412  
413 413 // Remove from history collection
414 414 this.remove(conversation);
app/scripts/storage/dbmanager.js View file @ 72f47d2
... ... @@ -133,7 +133,7 @@
133 133  
134 134 }, this);
135 135 } catch (ex) {
136   - callback(ex.message, null);
  136 + this._consumePendingActions(ex.message, null);
137 137 }
138 138 },
139 139