diff --git a/src/blocks/scratch3_procedures.js b/src/blocks/scratch3_procedures.js index 3ba743d8b..7fb31d28f 100644 --- a/src/blocks/scratch3_procedures.js +++ b/src/blocks/scratch3_procedures.js @@ -27,15 +27,17 @@ class Scratch3ProcedureBlocks { call (args, util) { if (!util.stackFrame.executed) { const procedureCode = args.mutation.proccode; - const [paramNames, paramIds] = util.getProcedureParamNamesAndIds(procedureCode); + const paramNamesAndIds = util.getProcedureParamNamesAndIds(procedureCode); // If null, procedure could not be found, which can happen if custom // block is dragged between sprites without the definition. // Match Scratch 2.0 behavior and noop. - if (paramNames === null) { + if (paramNamesAndIds === null) { return; } + const [paramNames, paramIds] = paramNamesAndIds; + for (let i = 0; i < paramIds.length; i++) { if (args.hasOwnProperty(paramIds[i])) { util.pushParam(paramNames[i], args[paramIds[i]]);