Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: skip camera restore loop when device is not connected

Richie McIlroyec79e9627b60
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rs
index 4dec972b3..5deba345c 100644
--- a/apps/desktop/src-tauri/src/windows.rs
+++ b/apps/desktop/src-tauri/src/windows.rs
@@ -397,7 +397,11 @@ pub(crate) async fn restore_main_window_inputs(app: &AppHandle) {
None
}
})
- .unwrap_or(None);
+ .unwrap_or(None)
+ // A remembered camera that isn't connected must not run the init/retry
+ // loop below: it would flash the preview window and toast an error on
+ // every main-window reveal while the device is away.
+ .filter(crate::is_camera_available);
if let Some(camera_id) = camera_to_restore {
emit_camera_preview_clear(app);