GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
fix: ensure target index is within bounds of parent's children on attach
Lars Berger28d03198732a
diff --git a/packages/wm/src/containers/commands/attach_container.rs b/packages/wm/src/containers/commands/attach_container.rsindex e221e9ba..c7eb1969 100644--- a/packages/wm/src/containers/commands/attach_container.rs+++ b/packages/wm/src/containers/commands/attach_container.rs@@ -18,8 +18,11 @@ pub fn attach_container(bail!("Cannot attach an already attached container.");}- // Insert the child at the specified index.if let Some(target_index) = target_index {+ // Ensure target index is within the bounds of the parent's children.+ let target_index = target_index.clamp(0, target_parent.child_count());++ // Insert the child at the specified index.target_parent.borrow_children_mut().insert(target_index, child.clone());