From 10ba8ebc7050d4290fa5bd9bbd3ed771c266afe3 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Wed, 26 Jul 2023 10:50:09 +0300 Subject: Don't assume xdg_surface.{toplevel,popup} is non-NULL This assumption will become incorrect with future commits. --- tinywl/tinywl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tinywl') diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 61c08928..e91ad283 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -122,7 +122,9 @@ static void focus_view(struct tinywl_view *view, struct wlr_surface *surface) { struct wlr_xdg_surface *previous = wlr_xdg_surface_try_from_wlr_surface(seat->keyboard_state.focused_surface); assert(previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); - wlr_xdg_toplevel_set_activated(previous->toplevel, false); + if (previous->toplevel != NULL) { + wlr_xdg_toplevel_set_activated(previous->toplevel, false); + } } struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat); /* Move the view to the front */ -- cgit v1.2.3