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 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs index 31ca144cf8a61946318dc518e7ffee29b4c06d6f..7aac72ed46e777a1c70a194cf79f9bad160d1028 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 publication = participant.publish_screenshare_track(&**source, cx).await; + 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 = match source { + Ok(source) => participant.publish_screenshare_track(&*source, cx).await, + Err(error) => Err(error), + }; this.update(cx, |this, cx| { let live_kit = this