diff --git a/crates/ewwii/src/app.rs b/crates/ewwii/src/app.rs index a3bd758..e187eab 100644 --- a/crates/ewwii/src/app.rs +++ b/crates/ewwii/src/app.rs @@ -849,7 +849,13 @@ impl App { match req { PluginRequest::RhaiEngineAct(func) => { let mut cp = cp.borrow_mut(); - cp.action_with_engine(func); + let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + cp.action_with_engine(func) + })); + + if let Err(e) = result { + log::error!("Panic in Rhai closure: {:?}", e); + } } PluginRequest::ListWidgetIds(res_tx) => { let wgs_guard = wgs.lock().unwrap();