Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: ocr panicking

Joe Goldin30f7345227ea
diff --git a/screenpipe-vision/src/microsoft.rs b/screenpipe-vision/src/microsoft.rs
index 30a1ea63a..d881014d6 100644
--- a/screenpipe-vision/src/microsoft.rs
+++ b/screenpipe-vision/src/microsoft.rs
@@ -1,5 +1,5 @@
use image::{DynamicImage, GenericImageView};
-use anyhow::{Result, bail};
+use anyhow::Result;
#[cfg(target_os = "windows")]
pub async fn perform_ocr_windows(image: &DynamicImage) -> Result<(String, String, Option<f64>)> {
@@ -13,7 +13,8 @@ pub async fn perform_ocr_windows(image: &DynamicImage) -> Result<(String, String
// Check image dimensions
let (width, height) = image.dimensions();
if width == 0 || height == 0 {
- bail!("Invalid image dimensions: {}x{}", width, height);
+ // Return an empty result instead of panicking
+ return Ok(("".to_string(), "[]".to_string(), None));
}
let mut buffer = Vec::new();