From 824c3935d9cf66540d4bb1c2c604bd0846c014fc Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 6 Mar 2017 13:17:58 +0000 Subject: [PATCH] Introduced more defensive checking for the end of a recipe. --- src/js/core/Recipe.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/js/core/Recipe.js b/src/js/core/Recipe.js index 5a8cadf3..a17b1b60 100755 --- a/src/js/core/Recipe.js +++ b/src/js/core/Recipe.js @@ -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; }