Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Guard against uninstantiated globals in tests

Mikayla Makic700342a1c4f
diff --git a/crates/audio/src/audio.rs b/crates/audio/src/audio.rs
index fd3f4e0515b..0216bf47be1 100644
--- a/crates/audio/src/audio.rs
+++ b/crates/audio/src/audio.rs
@@ -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 {