From fcafcbdd0a2ab3d387fd9b0ef4a52059560f6625 Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" Date: Thu, 4 Oct 2018 21:30:12 -0400 Subject: [PATCH] return 0 from parameters outside of their procedure --- src/blocks/scratch3_procedures.js | 8 ++++++-- src/engine/thread.js | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/blocks/scratch3_procedures.js b/src/blocks/scratch3_procedures.js index 5caea72ee..86aacd059 100644 --- a/src/blocks/scratch3_procedures.js +++ b/src/blocks/scratch3_procedures.js @@ -54,7 +54,9 @@ class Scratch3ProcedureBlocks { argumentReporterStringNumber (args, util) { const value = util.getParam(args.VALUE); if (value === null) { - return ''; + // When the parameter is not found in the most recent procedure + // call, the default is always 0. + return 0; } return value; } @@ -62,7 +64,9 @@ class Scratch3ProcedureBlocks { argumentReporterBoolean (args, util) { const value = util.getParam(args.VALUE); if (value === null) { - return false; + // When the parameter is not found in the most recent procedure + // call, the default is always 0. + return 0; } return value; } diff --git a/src/engine/thread.js b/src/engine/thread.js index 316642222..47777a97a 100644 --- a/src/engine/thread.js +++ b/src/engine/thread.js @@ -349,6 +349,7 @@ class Thread { if (frame.params.hasOwnProperty(paramName)) { return frame.params[paramName]; } + return null; } return null; }