Check if sound not defined
This commit is contained in:
1 parent
330aff8082
commit
064d6f9411
1 file changed
+1
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user