From 94916cd3b6592d1d0f64dbac89574e3b6c88181c Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Thu, 10 Jul 2025 17:35:21 -0600 Subject: [PATCH] Fix screenshare sources error handling, `is_sharing_screen() == false` on error (#34250) Release Notes: - N/A --- crates/call/src/call_impl/room.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs index 31ca144cf8..7aac72ed46 100644 --- a/crates/call/src/call_impl/room.rs +++ b/crates/call/src/call_impl/room.rs @@ -1389,10 +1389,17 @@ impl Room { let sources = cx.screen_capture_sources(); cx.spawn(async move |this, cx| { - let sources = sources.await??; - let source = sources.first().context("no display found")?; + let sources = sources + .await + .map_err(|error| error.into()) + .and_then(|sources| sources); + let source = + sources.and_then(|sources| sources.into_iter().next().context("no display found")); - let publication = participant.publish_screenshare_track(&**source, cx).await; + let publication = match source { + Ok(source) => participant.publish_screenshare_track(&*source, cx).await, + Err(error) => Err(error), + }; this.update(cx, |this, cx| { let live_kit = this