diff options
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index fbce8158..c91b0361 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1116,9 +1116,11 @@ void container_detach(struct sway_container *child) { | |||
1116 | struct sway_container *old_parent = child->parent; | 1116 | struct sway_container *old_parent = child->parent; |
1117 | struct sway_workspace *old_workspace = child->workspace; | 1117 | struct sway_workspace *old_workspace = child->workspace; |
1118 | list_t *siblings = container_get_siblings(child); | 1118 | list_t *siblings = container_get_siblings(child); |
1119 | int index = list_find(siblings, child); | 1119 | if (siblings) { |
1120 | if (index != -1) { | 1120 | int index = list_find(siblings, child); |
1121 | list_del(siblings, index); | 1121 | if (index != -1) { |
1122 | list_del(siblings, index); | ||
1123 | } | ||
1122 | } | 1124 | } |
1123 | child->parent = NULL; | 1125 | child->parent = NULL; |
1124 | child->workspace = NULL; | 1126 | child->workspace = NULL; |
@@ -1127,7 +1129,7 @@ void container_detach(struct sway_container *child) { | |||
1127 | if (old_parent) { | 1129 | if (old_parent) { |
1128 | container_update_representation(old_parent); | 1130 | container_update_representation(old_parent); |
1129 | node_set_dirty(&old_parent->node); | 1131 | node_set_dirty(&old_parent->node); |
1130 | } else { | 1132 | } else if (old_workspace) { |
1131 | workspace_update_representation(old_workspace); | 1133 | workspace_update_representation(old_workspace); |
1132 | node_set_dirty(&old_workspace->node); | 1134 | node_set_dirty(&old_workspace->node); |
1133 | } | 1135 | } |