Skip to content

Commit 1ce0176

Browse files
fix: replace toString with String in switch blocks
Prevent switch costume to (), switch backdrop to (), switch backdrop to () and wait from hanging
1 parent 3a55cf4 commit 1ce0176

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/scratch-vm/src/blocks/scratch3_looks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class Scratch3LooksBlocks {
392392
target.setCostume(optZeroIndex ? requestedCostume : requestedCostume - 1);
393393
} else {
394394
// Strings should be treated as costume names, where possible
395-
const costumeIndex = target.getCostumeIndexByName(requestedCostume.toString());
395+
const costumeIndex = target.getCostumeIndexByName(String(requestedCostume));
396396

397397
if (costumeIndex !== -1) {
398398
target.setCostume(costumeIndex);
@@ -426,7 +426,7 @@ class Scratch3LooksBlocks {
426426
stage.setCostume(optZeroIndex ? requestedBackdrop : requestedBackdrop - 1);
427427
} else {
428428
// Strings should be treated as backdrop names where possible
429-
const costumeIndex = stage.getCostumeIndexByName(requestedBackdrop.toString());
429+
const costumeIndex = stage.getCostumeIndexByName(String(requestedBackdrop));
430430

431431
if (costumeIndex !== -1) {
432432
stage.setCostume(costumeIndex);

0 commit comments

Comments
 (0)