Skip to content

Commit

Permalink
Remove items from _loadQueueBackup and _currentLoads with null item.
Browse files Browse the repository at this point in the history
The objects with null items have already been disposed and can no longer be matched
  • Loading branch information
Nathan Smith committed Jun 13, 2018
1 parent 07b57b4 commit 0fe44a0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/preloadjs/LoadQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,10 @@ this.createjs = this.createjs || {};
//Remove from the backup queue
for (i = this._loadQueueBackup.length - 1; i >= 0; i--) {
loadItem = this._loadQueueBackup[i].getItem();
if (loadItem.id == item || loadItem.src == item) {
if(!loadItem){
// Remove objects that have been disposed and have null item
this._loadQueueBackup.splice(i, 1)[0].cancel();
} else if (loadItem.id == item || loadItem.src == item) {
this._loadQueueBackup.splice(i, 1)[0].cancel();
break;
}
Expand All @@ -784,7 +787,11 @@ this.createjs = this.createjs || {};
} else {
for (var i = this._currentLoads.length - 1; i >= 0; i--) {
var loadItem = this._currentLoads[i].getItem();
if (loadItem.id == item || loadItem.src == item) {
if(!loadItem){
// Remove objects that have been disposed and have null item
this._currentLoads.splice(i, 1)[0].cancel();
itemsWereRemoved = true;
} else if (loadItem.id == item || loadItem.src == item) {
this._currentLoads.splice(i, 1)[0].cancel();
itemsWereRemoved = true;
break;
Expand Down

0 comments on commit 0fe44a0

Please sign in to comment.