summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-10-13 13:13:55 +0200
committerRan Benita <ran234@gmail.com>2012-10-13 13:13:55 +0200
commitf43b33c02fe6081bc1a04087974c52c96f6fee35 (patch)
tree0b739215eebc9fa6b32cc0ff239072a04e746e45 /src/state.c
parent523e46f41aca7bdb05e07e44e2023c3c4ffce16b (diff)
downloadxorg-lib-libxkbcommon-f43b33c02fe6081bc1a04087974c52c96f6fee35.tar.gz
state: make mod_index_is_consumed() return -1 on invalid input
Like all the other functions. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c
index 1511342..4c159fc 100644
--- a/src/state.c
+++ b/src/state.c
@@ -1052,8 +1052,8 @@ xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc,
{
const struct xkb_key *key = XkbKey(state->keymap, kc);
- if (!key)
- return 0;
+ if (!key || idx >= xkb_keymap_num_mods(state->keymap))
+ return -1;
return !!((1 << idx) & key_get_consumed(state, key));
}