diff --git a/libweston/compositor.c b/libweston/compositor.c index 856473b50..8b23d7bc5 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -5895,8 +5895,10 @@ subsurface_set_sync(struct wl_client *client, struct wl_resource *resource) { struct weston_subsurface *sub = wl_resource_get_user_data(resource); - if (sub) - sub->synchronized = true; + if (!sub) + return; + + sub->synchronized = true; } static void @@ -5904,7 +5906,10 @@ subsurface_set_desync(struct wl_client *client, struct wl_resource *resource) { struct weston_subsurface *sub = wl_resource_get_user_data(resource); - if (sub && sub->synchronized) { + if (!sub) + return; + + if (sub->synchronized) { sub->synchronized = false; /* If sub became effectively desynchronized, flush. */