mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 修复可能导致的 panic
This commit is contained in:
@@ -56,8 +56,11 @@ async fn register_deep_link(app_handle: tauri::AppHandle) {
|
|||||||
// 执行 js
|
// 执行 js
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn execute_js(app_handle: tauri::AppHandle, label: String, js: String) {
|
async fn execute_js(app_handle: tauri::AppHandle, label: String, js: String) {
|
||||||
let window = app_handle.get_window(&label).unwrap();
|
let window = app_handle.get_window(&label);
|
||||||
window.eval(&js).ok().unwrap();
|
if window.is_none() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.unwrap().eval(&js).ok().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建窗口
|
// 创建窗口
|
||||||
|
|||||||
Reference in New Issue
Block a user