Guard against uninstantiated globals in tests
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user