mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Cast 'create clone' argument to string. Resolves GH-974
This commit is contained in:
parent
cde801bc17
commit
218725d771
1 changed files with 9 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue