From ec39ddee632a41ae243e7014992febf94258c5c4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 25 May 2020 20:38:16 -0400 Subject: [PATCH] Help static analysis with an assertion It is hard for clang to see that layouts will always be smaller than num_layouts, so just assert that. --- gdk/wayland/gdkkeys-wayland.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c index 802463298e..ef41b287ef 100644 --- a/gdk/wayland/gdkkeys-wayland.c +++ b/gdk/wayland/gdkkeys-wayland.c @@ -412,6 +412,7 @@ update_direction (GdkWaylandKeymap *keymap) gint layouts, layout; layouts = xkb_keymap_num_layouts_for_key (keymap->xkb_keymap, key); + g_assert (layouts <= num_layouts); for (layout = 0; layout < layouts; layout++) { const xkb_keysym_t *syms;