don't crash when clicking an empty area

If l is not initialized, accessing
l->layer_surface->current.keyboard_interactive causes a segmentation
fault. This was hard to see because c above was never initialized but
never caused a crash, and dwl also didn't crash building with ASan.

Also initialize c to be safe.

Fixes 4c54bd8.
Fixes https://codeberg.org/dwl/dwl/issues/1225.
This commit is contained in:
Guido Cella
2026-09-13 08:25:20 +02:00
parent fb4102b5ae
commit 7ba335063f
+2 -2
View File
@@ -643,8 +643,8 @@ buttonpress(struct wl_listener *listener, void *data)
struct wlr_pointer_button_event *event = data;
struct wlr_keyboard *keyboard;
uint32_t mods;
Client *c;
LayerSurface *l;
Client *c = NULL;
LayerSurface *l = NULL;
const Button *b;
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);