Check group index lower limit

This commit is contained in:
Nabos 2023-01-17 15:47:27 +01:00
parent 1234264d75
commit 0db1faa1c5

View file

@ -413,6 +413,7 @@ fn focus_to_group(stream: &UnixStream, group_index: usize) {
current_workspace_index - (current_workspace_index / 10) * 10; current_workspace_index - (current_workspace_index / 10) * 10;
let target_workspace_index = group_index * 10 + contextual_target_workspace_index; let target_workspace_index = group_index * 10 + contextual_target_workspace_index;
println!("{target_workspace_index}");
// If the workspace already exists // If the workspace already exists
match workspaces.iter().find(|w| w.num == target_workspace_index) { match workspaces.iter().find(|w| w.num == target_workspace_index) {
@ -435,7 +436,7 @@ fn focus_to_group(stream: &UnixStream, group_index: usize) {
), ),
None => { None => {
// Or if the targeted output is currently connected // Or if the targeted output is currently connected
if group_index <= outputs.len() { if group_index != 0 && group_index <= outputs.len() {
Some(group_index) Some(group_index)
} else { } else {
None None