diff --git a/lib/runCode.js b/lib/runCode.js index 7063614c903..506770ac296 100644 --- a/lib/runCode.js +++ b/lib/runCode.js @@ -173,6 +173,8 @@ module.exports = function (opts, cb) { // create a callback for async opFunc if (opInfo.async) { args.push(function (err, result) { + if (err) return cb(err) + // save result to the stack if (result) { // NOTE: Ensure that every stack item is padded to 256 bits. @@ -180,7 +182,8 @@ module.exports = function (opts, cb) { result = utils.setLengthLeft(result, 32) runState.stack.push(result) } - cb(err) + + cb() }) }