mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
Merge pull request #1087 from thisandagain/bugfix/974
Cast 'create clone' argument to string
This commit is contained in:
commit
1ed5d57c98
1 changed files with 9 additions and 3 deletions
|
@ -144,15 +144,21 @@ class Scratch3ControlBlocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
createClone (args, util) {
|
createClone (args, util) {
|
||||||
|
// Cast argument to string
|
||||||
|
args.CLONE_OPTION = Cast.toString(args.CLONE_OPTION);
|
||||||
|
|
||||||
|
// Set clone target
|
||||||
let cloneTarget;
|
let cloneTarget;
|
||||||
if (args.CLONE_OPTION === '_myself_') {
|
if (args.CLONE_OPTION === '_myself_') {
|
||||||
cloneTarget = util.target;
|
cloneTarget = util.target;
|
||||||
} else {
|
} else {
|
||||||
cloneTarget = this.runtime.getSpriteTargetByName(args.CLONE_OPTION);
|
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();
|
const newClone = cloneTarget.makeClone();
|
||||||
if (newClone) {
|
if (newClone) {
|
||||||
this.runtime.targets.push(newClone);
|
this.runtime.targets.push(newClone);
|
||||||
|
|
Loading…
Reference in a new issue