subsurface: handle NULL parent in get_root_surface

This commit is contained in:
Isaac Freund 2020-12-13 16:07:31 +01:00 committed by Simon Ser
parent ad4dae0844
commit f6fc4c2883
2 changed files with 5 additions and 1 deletions

View file

@ -1061,6 +1061,9 @@ struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface) {
if (subsurface == NULL) {
break;
}
if (subsurface->parent == NULL) {
return NULL;
}
surface = subsurface->parent;
}
return surface;