From: Ran Benita Date: Fri, 21 Sep 2012 18:16:20 +0000 (+0300) Subject: state: missing XKB_EXPORT on xkb_state_key_get_level X-Git-Tag: xkbcommon-0.2.0~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=419a497554a7afe6ee3309e2e481d99465a134f7;p=platform%2Fupstream%2Flibxkbcommon.git state: missing XKB_EXPORT on xkb_state_key_get_level And some error handling. Signed-off-by: Ran Benita --- diff --git a/src/state.c b/src/state.c index bfe35bb..ef770cc 100644 --- a/src/state.c +++ b/src/state.c @@ -128,13 +128,16 @@ get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key, * Returns the level to use for the given key and state, or * XKB_LEVEL_INVALID. */ -xkb_level_index_t +XKB_EXPORT xkb_level_index_t xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t kc, xkb_layout_index_t layout) { const struct xkb_key *key = XkbKey(state->keymap, kc); struct xkb_kt_map_entry *entry; + if (!key || layout >= key->num_groups) + return XKB_LEVEL_INVALID; + /* If we don't find an explicit match the default is 0. */ entry = get_entry_for_key_state(state, key, layout); if (!entry)