diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-15 08:17:41 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-15 08:17:41 +1000 |
commit | 289130430f3242ecdc25eb2bf84e20564b360c68 (patch) | |
tree | a46789c96e74e56ef9bf84d83e26c1937bdfe57e | |
parent | 2024f1da72d5144a30864d815608e2e856639bf6 (diff) |
Fix invalid pointers when using resize grow width on first/last siblings
-rw-r--r-- | sway/commands/resize.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index f6141afc..6cdeb90c 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c @@ -173,8 +173,17 @@ void container_resize_tiled(struct sway_container *con, int index = container_sibling_index(con); if (axis == AXIS_HORIZONTAL || axis == AXIS_VERTICAL) { - prev = siblings->items[index - 1]; - next = siblings->items[index + 1]; + if (index == 0) { + next = siblings->items[1]; + } else if (index == siblings->length - 1) { + // Convert edge to top/left + next = con; + con = siblings->items[index - 1]; + amount = -amount; + } else { + prev = siblings->items[index - 1]; + next = siblings->items[index + 1]; + } } else if (axis == WLR_EDGE_TOP || axis == WLR_EDGE_LEFT) { if (!sway_assert(index > 0, "Didn't expect first child")) { return; |