mirror of
https://github.com/swaywm/sway.git
synced 2026-02-05 04:06:25 -05:00
tree/workspace: fix crash on dragging container to workspace edge
Problem: when dragging a parent container to the right of its children, sway crashes, the calculated insertion index could exceed the list bounds. The move logic would compute an index based on the pre-removal list state. Solution: Clamp the insertion index to [0, length].
This commit is contained in:
parent
b081eba05d
commit
9d2e7d378f
1 changed files with 2 additions and 0 deletions
|
|
@ -842,6 +842,8 @@ struct sway_container *workspace_insert_tiling(struct sway_workspace *workspace,
|
|||
if (config->default_layout != L_NONE) {
|
||||
con = container_split(con, config->default_layout);
|
||||
}
|
||||
if (index < 0) index = 0;
|
||||
else if (index > workspace->tiling->length) index = workspace->tiling->length;
|
||||
workspace_insert_tiling_direct(workspace, con, index);
|
||||
return con;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue