diff --git a/crates/ui-egui/src/workflows/files.rs b/crates/ui-egui/src/workflows/files.rs index a9313a4714..17870e5b1a 100644 --- a/crates/ui-egui/src/workflows/files.rs +++ b/crates/ui-egui/src/workflows/files.rs @@ -28,6 +28,13 @@ pub enum FilePurpose { RedactWords, } +#[cfg(not(target_arch = "wasm32"))] +fn discover_fonts_safely( + discover: impl FnOnce() -> Vec + std::panic::UnwindSafe, +) -> Vec { + std::panic::catch_unwind(discover).unwrap_or_default() +} + /// Discover installed document fonts off the GUI thread, only when the picker is opened. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn installed_font_files(ctx: &egui::Context) -> Option> { @@ -41,7 +48,7 @@ pub(crate) fn installed_font_files(ctx: &egui::Context) -> Option