diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-16 14:18:13 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-16 14:18:13 +1000 |
commit | 09733e233feffe5ec088d10f4de03df8594ec68b (patch) | |
tree | 1b57c6edfc1a0da28f03088b1290c0e0e9bd9eb0 | |
parent | Merge pull request #2634 from ianyfan/ipc (diff) | |
download | sway-09733e233feffe5ec088d10f4de03df8594ec68b.tar.gz sway-09733e233feffe5ec088d10f4de03df8594ec68b.tar.zst sway-09733e233feffe5ec088d10f4de03df8594ec68b.zip |
Fix crash when unmapping last child of a tabbed workspace
* Create layout T[view view]
* Move the cursor into the title bar area
* Close both views
Sway would crash because container_at_tabbed would attempt to divide by
zero when there are no children.
The children check isn't needed for the stacked function because it
doesn't divide anything by the number of children.
Fixes #2636.
-rw-r--r-- | sway/tree/container.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index df064573..f906449a 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -202,6 +202,9 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent, | |||
202 | } | 202 | } |
203 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 203 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
204 | list_t *children = node_get_children(parent); | 204 | list_t *children = node_get_children(parent); |
205 | if (!children->length) { | ||
206 | return NULL; | ||
207 | } | ||
205 | 208 | ||
206 | // Tab titles | 209 | // Tab titles |
207 | int title_height = container_titlebar_height(); | 210 | int title_height = container_titlebar_height(); |