diff --git a/crates/tauri/src/plugin/mobile.rs b/crates/tauri/src/plugin/mobile.rs index 64aff828f..8aae62980 100644 --- a/crates/tauri/src/plugin/mobile.rs +++ b/crates/tauri/src/plugin/mobile.rs @@ -373,12 +373,12 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + CStr::from_ptr(payload) }; - if let Some(handler) = PENDING_PLUGIN_CALLS + let handler = PENDING_PLUGIN_CALLS .get_or_init(Default::default) .lock() .unwrap() - .remove(&id) - { + .remove(&id); + if let Some(handler) = handler { let json = payload.to_str().unwrap(); match serde_json::from_str(json) { Ok(payload) => {