aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-12 23:21:11 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-18 15:11:48 -0500
commitad34837ddaab418fc4d5aed61370227d634912cc (patch)
tree713ecaee3ef3fc3eb3077ae06327f3a058e76e2b
parentcursor: relative-pointer-v1 time is usec (diff)
downloadsway-ad34837ddaab418fc4d5aed61370227d634912cc.tar.gz
sway-ad34837ddaab418fc4d5aed61370227d634912cc.tar.zst
sway-ad34837ddaab418fc4d5aed61370227d634912cc.zip
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,
708 while (surface && wlr_surface_is_subsurface(surface)) { 708 while (surface && wlr_surface_is_subsurface(surface)) {
709 struct wlr_subsurface *subsurface = 709 struct wlr_subsurface *subsurface =
710 wlr_subsurface_from_wlr_surface(surface); 710 wlr_subsurface_from_wlr_surface(surface);
711 if (subsurface == NULL) {
712 break;
713 }
711 *root_sx += subsurface->current.x; 714 *root_sx += subsurface->current.x;
712 *root_sy += subsurface->current.y; 715 *root_sy += subsurface->current.y;
713 surface = subsurface->parent; 716 surface = subsurface->parent;