From 218725d7714cae85be408add1ee316b016bc43a9 Mon Sep 17 00:00:00 2001 From: Andrew Sliwinski Date: Thu, 26 Apr 2018 10:29:29 -0400 Subject: [PATCH] Cast 'create clone' argument to string. Resolves GH-974 --- src/blocks/scratch3_control.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/blocks/scratch3_control.js b/src/blocks/scratch3_control.js index 3f7a8e79b..4636d282d 100644 --- a/src/blocks/scratch3_control.js +++ b/src/blocks/scratch3_control.js @@ -144,15 +144,21 @@ class Scratch3ControlBlocks { } createClone (args, util) { + // Cast argument to string + args.CLONE_OPTION = Cast.toString(args.CLONE_OPTION); + + // Set clone target let cloneTarget; if (args.CLONE_OPTION === '_myself_') { cloneTarget = util.target; } else { cloneTarget = this.runtime.getSpriteTargetByName(args.CLONE_OPTION); } - if (!cloneTarget) { - return; - } + + // If clone target is not found, return + if (!cloneTarget) return; + + // Create clone const newClone = cloneTarget.makeClone(); if (newClone) { this.runtime.targets.push(newClone);