Dock: fix crash dragging a pallet that is alone in its group

Dragging a pallet over its own group (e.g. the block palette, alone on
the right edge) targeted joining that group. Joining first detached the
pallet, which removed the now-empty group, then indexed it: an
out-of-bounds panic, hit already by the live drop preview. A pallet alone
in the group it would join now just stays put.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013RyGiMXcsf9HTKfqDxaQGt
This commit is contained in:
Claude committed 2026-10-09 19:29:37 +00:00
1 parent 258762f992
commit 77ddc59df3
2 files changed
+36

No files matched your search

+25
View File
@@ -2111,6 +2111,31 @@ mod tests {
);
}
#[test]
fn dock_dragging_a_lone_pallet_over_its_own_group_is_a_no_op() {
use crate::app::config::DockSide;
use crate::ui::dock::{DropTarget, PanelId};
let mut app = dock_app();
let before = app.dock.clone();
// The right edge's only group holds just the block palette; drag it
// around over itself.
let target = drag_panel(
&mut app,
PanelId::BlockPalette,
iced::Point::new(1500.0, 10.0),
iced::Point::new(1450.0, 600.0),
);
assert_eq!(
target,
Some(DropTarget::Join {
side: DockSide::Right,
group: 0,
index: 1
})
);
assert_eq!(app.dock, before);
}
#[test]
fn dock_click_without_drag_changes_nothing() {
let mut app = dock_app();