Skip to content

Commit 276ce44

Browse files
committed
Fix bug in allDone if no promise is present
1 parent 03f64e1 commit 276ce44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

interface.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,15 @@
127127
var prom = new Promise();
128128

129129
var N = this.promises.length;
130-
for(var i = 0; i < this.promises.length; i++)
130+
for(var i = 0; i < this.promises.length; i++) {
131131
this.promises[i].then(function() {
132132
N--;
133133
if(N == 0)
134134
prom.fulfil();
135135
});
136+
}
137+
if(this.promises.length === 0)
138+
prom.fulfil();
136139

137140
return prom;
138141
}

0 commit comments

Comments
 (0)