Skip to content

Commit

Permalink
Fixes #432
Browse files Browse the repository at this point in the history
  • Loading branch information
petkaantonov committed Jan 11, 2015
1 parent 19fc3fe commit dc6d8df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/promise_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
this._values = this.shouldCopyValues() ? new Array(len) : this._values;
var promise = this._promise;
for (var i = 0; i < len; ++i) {
if (this._isResolved()) return;
var isResolved = this._isResolved();
var maybePromise = tryConvertToPromise(values[i], promise);
if (maybePromise instanceof Promise) {
maybePromise = maybePromise._target();
if (maybePromise._isPending()) {
if (isResolved) {
maybePromise._unsetRejectionIsUnhandled();
} else if (maybePromise._isPending()) {
// Optimized for just passing the updates through
maybePromise._proxyPromiseArray(this, i);
} else if (maybePromise._isFulfilled()) {
Expand All @@ -109,7 +111,7 @@ PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
maybePromise._unsetRejectionIsUnhandled();
this._promiseRejected(maybePromise._reason(), i);
}
} else {
} else if (!isResolved) {
this._promiseFulfilled(maybePromise, i);
}
}
Expand Down

0 comments on commit dc6d8df

Please sign in to comment.