From cdc057f09aed320dedc63a5f1845e193eeb0aaa3 Mon Sep 17 00:00:00 2001 From: tiosgz Date: Thu, 10 Feb 2022 08:32:08 +0000 Subject: [PATCH] seat: NULL-check on keyboard.modifiers event It can be sent before keyboard.keymap (for example when running swaylock from a different tty), in which case the xkb state isn't initialized yet. --- seat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/seat.c b/seat.c index ff0acec..eb837b3 100644 --- a/seat.c +++ b/seat.c @@ -86,6 +86,10 @@ static void keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t mods_locked, uint32_t group) { struct swaylock_seat *seat = data; struct swaylock_state *state = seat->state; + if (state->xkb.state == NULL) { + return; + } + int layout_same = xkb_state_layout_index_is_active(state->xkb.state, group, XKB_STATE_LAYOUT_EFFECTIVE); if (!layout_same) {