Check if sound not defined
This commit is contained in:
parent
330aff8082
commit
064d6f9411
@ -284,6 +284,7 @@ namespace music {
|
|||||||
//% blockId=music_play_sound_effect block="play sound effect %sound"
|
//% blockId=music_play_sound_effect block="play sound effect %sound"
|
||||||
//% weight=99
|
//% weight=99
|
||||||
export function playSoundEffect(sound: Sound) {
|
export function playSoundEffect(sound: Sound) {
|
||||||
|
if (!sound) return;
|
||||||
control.runInBackground(() => sound.play());
|
control.runInBackground(() => sound.play());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user