-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LoadQueue.remove may throw error in some condition #251
Comments
This seems to indicate that the loadItem is null. Do you have more context you can provide? |
it hanppens when i remove some loaded items, now i changed to use removeAll. i don't know why the loaditem is null, maybe it should be checked before remove it |
I'm having this same problem when I use Fiddler to simulate failed asset (sound) downloads. |
I'm using Chrome and it's attempting to download .mp3 files via XHR requests. If the download fails with a status code defined as an error below the item can be removed from the queue without a problem. If the download fails with some 302 redirect to html or 200 and html/text I receive: Uncaught (in promise) DOMException: Unable to decode audio data That seems to leave the request still somewhat active or at least still in the (_currentLoads) queue. Then what happens is the next time remove is called it iterates through the items removing the item specified. When the item is removed from the second loop it calls cancel. The details of cancel can be seen in the second photo. Basically it sets the item value to null. So when it get's to the third loop the item value is null and the if statement generates an error vs removing the item. On the second loop of (3) Remove it calls (2) Cancel which calls (1) Destroy |
This is a possible solution. It assumes all objects with null item have already been disposed. |
Simple var q = new createjs.LoadQueue(false);
q.loadFile({id:'goog', src:"http://google.com/", type: createjs.Types.HTML});
// q.setPaused(true); // doesn't matter
q.loadFile({id:'duck', src:"http://duck.com/", type: createjs.Types.HTML});
q.remove('duck'); // << here leads to Line 5049 in eab00cf
|
the following code throw error null is not an object (evaluating 'loadItem.id')
...
loadItem = this._loadQueueBackup[i].getItem();
if (loadItem.id == item || loadItem.src == item) {
this._loadQueueBackup.splice(i, 1)[0].cancel();
break;
}
...
The text was updated successfully, but these errors were encountered: