Skip to content

Commit

Permalink
Merge pull request #1087 from thisandagain/bugfix/974
Browse files Browse the repository at this point in the history
Cast 'create clone' argument to string
  • Loading branch information
thisandagain committed Apr 26, 2018
2 parents 5f20609 + 218725d commit 1ed5d57
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/blocks/scratch3_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1ed5d57

Please sign in to comment.