aboutsummaryrefslogtreecommitdiff
path: root/src/layout/monitor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/monitor.rs')
-rw-r--r--src/layout/monitor.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index 009e2860..74c83317 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -772,6 +772,10 @@ impl<W: LayoutElement> Monitor<W> {
}
pub fn move_workspace_to_idx(&mut self, old_idx: usize, new_idx: usize) {
+ if self.workspaces.len() <= old_idx {
+ return;
+ }
+
let mut new_idx = new_idx.clamp(0, self.workspaces.len() - 1);
if old_idx == new_idx {
return;