Skip to content

Commit f3d9f14

Browse files
committed
Fixed flow error when the Loader would never complete if every single file failed.
1 parent 8c3422f commit f3d9f14

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/loader/LoaderPlugin.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ var LoaderPlugin = new Class({
7979

8080
setBaseURL: function (url)
8181
{
82-
if (url.substr(-1) !== '/')
82+
if (url !== '' && url.substr(-1) !== '/')
8383
{
8484
url = url.concat('/');
8585
}
@@ -91,7 +91,7 @@ var LoaderPlugin = new Class({
9191

9292
setPath: function (path)
9393
{
94-
if (path.substr(-1) !== '/')
94+
if (path !== '' && path.substr(-1) !== '/')
9595
{
9696
path = path.concat('/');
9797
}
@@ -165,6 +165,8 @@ var LoaderPlugin = new Class({
165165
{
166166
this.progress = 1 - (this.list.size / this.totalToLoad);
167167

168+
// console.log(this.progress);
169+
168170
this.emit('progress', this.progress);
169171
},
170172

@@ -257,11 +259,19 @@ var LoaderPlugin = new Class({
257259

258260
this.storage.clear();
259261

260-
this.queue.each(function (file)
262+
if (this.queue.size === 0)
261263
{
262-
// console.log('%c Calling process on ' + file.key, 'color: #000000; background: #ffff00;');
263-
file.onProcess(this.processUpdate.bind(this));
264-
}, this);
264+
// Everything failed, so nothing to process
265+
this.processComplete();
266+
}
267+
else
268+
{
269+
this.queue.each(function (file)
270+
{
271+
// console.log('%c Calling process on ' + file.key, 'color: #000000; background: #ffff00;');
272+
file.onProcess(this.processUpdate.bind(this));
273+
}, this);
274+
}
265275
},
266276

267277
// Called automatically by the File when it has finished processing

0 commit comments

Comments
 (0)