Add check for Shortcut::None when registering a shortcut

This commit is contained in:
Thorsten Sommer 2026-01-24 19:49:34 +01:00
parent be381e8cf9
commit da8a5e952b
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -745,6 +745,14 @@ pub fn register_shortcut(_token: APIToken, payload: Json<RegisterShortcutRequest
let id = payload.id; let id = payload.id;
let new_shortcut = payload.shortcut.clone(); let new_shortcut = payload.shortcut.clone();
if id == Shortcut::None {
error!(Source = "Tauri"; "Cannot register NONE shortcut.");
return Json(ShortcutResponse {
success: false,
error_message: "Cannot register NONE shortcut".to_string(),
});
}
info!(Source = "Tauri"; "Registering global shortcut '{}' with key '{new_shortcut}'.", id); info!(Source = "Tauri"; "Registering global shortcut '{}' with key '{new_shortcut}'.", id);
// Get the main window to access the global shortcut manager: // Get the main window to access the global shortcut manager: