Guard against uninstantiated globals in tests
This commit is contained in:
parent
0e4c904091
commit
c700342a1c
1 changed files with 4 additions and 0 deletions
|
@ -44,6 +44,10 @@ impl Audio {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn play_sound(sound: Sound, cx: &AppContext) {
|
pub fn play_sound(sound: Sound, cx: &AppContext) {
|
||||||
|
if !cx.has_global::<Self>() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let this = cx.global::<Self>();
|
let this = cx.global::<Self>();
|
||||||
|
|
||||||
let Some(output_handle) = this.output_handle.as_ref() else {
|
let Some(output_handle) = this.output_handle.as_ref() else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue