mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Fix procedure name lookup to work with undefined procedures.
This commit is contained in:
parent
a586c5d9cd
commit
0fe7eca018
1 changed files with 4 additions and 2 deletions
|
@ -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]]);
|
||||
|
|
Loading…
Reference in a new issue