Fix segv when sway is terminating

I've got the following SIGSEGV when terminating sway:
```
Program terminated with signal SIGSEGV, Segmentation fault.
0x00005607dc603af5 in view_unmap (view=0x5607dcb3d350) at ../sway/tree/view.c:599
599		if (surviving_ancestor->type >= C_WORKSPACE) {
```
surviving_ancestor was NULL at that time

This commit is trying to fix this problem.
This commit is contained in:
Mariusz Bialonczyk 2018-08-05 16:59:10 +02:00
parent 0cd418ba42
commit 776b9b7e1f

View file

@ -596,7 +596,7 @@ void view_unmap(struct sway_view *view) {
struct sway_container *surviving_ancestor = container_destroy(view->swayc); struct sway_container *surviving_ancestor = container_destroy(view->swayc);
// If the workspace wasn't reaped // If the workspace wasn't reaped
if (surviving_ancestor->type >= C_WORKSPACE) { if (surviving_ancestor && surviving_ancestor->type >= C_WORKSPACE) {
struct sway_container *ws = surviving_ancestor->type == C_WORKSPACE ? struct sway_container *ws = surviving_ancestor->type == C_WORKSPACE ?
surviving_ancestor : surviving_ancestor :
container_parent(surviving_ancestor, C_WORKSPACE); container_parent(surviving_ancestor, C_WORKSPACE);