Guard against uninstantiated globals in tests

This commit is contained in:
Mikayla Maki 2023-07-03 13:48:17 -07:00
parent 0e4c904091
commit c700342a1c
No known key found for this signature in database

View file

@ -44,6 +44,10 @@ impl Audio {
}
pub fn play_sound(sound: Sound, cx: &AppContext) {
if !cx.has_global::<Self>() {
return;
}
let this = cx.global::<Self>();
let Some(output_handle) = this.output_handle.as_ref() else {