summaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'render.c')
-rw-r--r--render.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/render.c b/render.c
index 1aa8ae5..a5e978f 100644
--- a/render.c
+++ b/render.c
@@ -166,19 +166,21 @@ static bool render_frame(struct swaylock_surface *surface) {
}
}
- xkb_layout_index_t num_layout = xkb_keymap_num_layouts(state->xkb.keymap);
- if (!state->args.hide_keyboard_layout &&
- (state->args.show_keyboard_layout || num_layout > 1)) {
- xkb_layout_index_t curr_layout = 0;
-
- // advance to the first active layout (if any)
- while (curr_layout < num_layout &&
- xkb_state_layout_index_is_active(state->xkb.state,
- curr_layout, XKB_STATE_LAYOUT_EFFECTIVE) != 1) {
- ++curr_layout;
+ if (state->xkb.keymap) {
+ xkb_layout_index_t num_layout = xkb_keymap_num_layouts(state->xkb.keymap);
+ if (!state->args.hide_keyboard_layout &&
+ (state->args.show_keyboard_layout || num_layout > 1)) {
+ xkb_layout_index_t curr_layout = 0;
+
+ // advance to the first active layout (if any)
+ while (curr_layout < num_layout &&
+ xkb_state_layout_index_is_active(state->xkb.state,
+ curr_layout, XKB_STATE_LAYOUT_EFFECTIVE) != 1) {
+ ++curr_layout;
+ }
+ // will handle invalid index if none are active
+ layout_text = xkb_keymap_layout_get_name(state->xkb.keymap, curr_layout);
}
- // will handle invalid index if none are active
- layout_text = xkb_keymap_layout_get_name(state->xkb.keymap, curr_layout);
}
}
}