From af49b7658635f5d40dc31313b11f0bbaa3553999 Mon Sep 17 00:00:00 2001 From: fwsmit Date: Tue, 6 Apr 2021 17:17:14 +0200 Subject: [PATCH] wayland: fix NULL pointer dereference --- src/wayland/wl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wayland/wl.c b/src/wayland/wl.c index 4fae2f4..c6cd89a 100644 --- a/src/wayland/wl.c +++ b/src/wayland/wl.c @@ -284,10 +284,12 @@ static void layer_surface_handle_configure(void *data, static void layer_surface_handle_closed(void *data, struct zwlr_layer_surface_v1 *surface) { LOG_I("Destroying layer"); - zwlr_layer_surface_v1_destroy(ctx.layer_surface); + if (ctx.layer_surface) + zwlr_layer_surface_v1_destroy(ctx.layer_surface); ctx.layer_surface = NULL; - wl_surface_destroy(ctx.surface); + if (ctx.surface) + wl_surface_destroy(ctx.surface); ctx.surface = NULL; if (ctx.frame_callback) {