Introduced more defensive checking for the end of a recipe.
This commit is contained in:
parent
7f0ce0da8d
commit
824c3935d9
@ -159,8 +159,7 @@ Recipe.prototype.execute = function(dish, currentStep, state) {
|
||||
return e;
|
||||
};
|
||||
|
||||
// Operations can be asynchronous so we have to return a Promise to a
|
||||
// future value.
|
||||
// Operations can be asynchronous so we have to return a Promise to a future value.
|
||||
return new Promise(function(resolve, reject) {
|
||||
// Helper function to clean up recursing to the next recipe step.
|
||||
// It is a closure to avoid having to pass in resolve and reject.
|
||||
@ -180,7 +179,7 @@ Recipe.prototype.execute = function(dish, currentStep, state) {
|
||||
|
||||
currentStep = currentStep || 0;
|
||||
|
||||
if (currentStep === recipe.opList.length) {
|
||||
if (currentStep >= recipe.opList.length) {
|
||||
resolve(currentStep);
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user