diff --git a/src/wkwebview/class/url_scheme_handler.rs b/src/wkwebview/class/url_scheme_handler.rs index 07bb514af..8295c522f 100644 --- a/src/wkwebview/class/url_scheme_handler.rs +++ b/src/wkwebview/class/url_scheme_handler.rs @@ -261,8 +261,15 @@ extern "C" fn start_task( })) .unwrap(); - webview.remove_custom_task_key(task_key); - Ok(()) + { + let ids = WEBVIEW_IDS.lock().unwrap(); + if ids.contains(webview_id) { + webview.remove_custom_task_key(task_key); + Ok(()) + } else { + Err(crate::Error::CustomProtocolTaskInvalid) + } + } } let _ = response(