From 45f8a52eb598bfee94bd87ca35fd7628b9faa3ec Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 10 Jul 2024 09:52:07 +0100 Subject: [PATCH] try_recv to remove unwrap --- tracker/desktop-player/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracker/desktop-player/src/main.rs b/tracker/desktop-player/src/main.rs index 18d108a0..5f8e6092 100644 --- a/tracker/desktop-player/src/main.rs +++ b/tracker/desktop-player/src/main.rs @@ -42,7 +42,7 @@ fn main() -> Result<(), Box> { &config.into(), move |data: &mut [f32], _| { for val in data.iter_mut() { - *val = rx.recv().unwrap(); + *val = rx.try_recv().unwrap_or(0.0); } }, |err| eprintln!("Error on audio stream {err}"),