summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2019-02-12 23:21:11 -0500
committerFurkan Sahin <furkan-dev@proton.me>2019-02-12 23:21:11 -0500
commite426ff1144157801a52f73a83f9e63dfeb944da4 (patch)
tree713ecaee3ef3fc3eb3077ae06327f3a058e76e2b
parentc9059c3fe07355016def6f670def31d143e0f9d4 (diff)
subsurface_get_root_coords: break on NULL
It is possible for `wlr_surface_is_subsurface` to return true, but `wlr_surface_from_wlr_surface` to be NULL. This adds a NULL check to the value returned by `wlr_surface_from_wlr_surface` and breaks out of the while loop in `subsurface_get_root_coords`.
-rw-r--r--sway/tree/view.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 943734dc..ca13def7 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -708,6 +708,9 @@ static void subsurface_get_root_coords(struct sway_view_child *child,
while (surface && wlr_surface_is_subsurface(surface)) {
struct wlr_subsurface *subsurface =
wlr_subsurface_from_wlr_surface(surface);
+ if (subsurface == NULL) {
+ break;
+ }
*root_sx += subsurface->current.x;
*root_sy += subsurface->current.y;
surface = subsurface->parent;