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.

Fix screenshare sources error handling, `is_sharing_screen() == false` on error (#34250)

Michael Sloan94916cd3b659
diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs
index 31ca144cf8a..7aac72ed46e 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