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

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-07-10 17:35:21 -06:00 committed by GitHub
parent 7915b9f93f
commit 94916cd3b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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