summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console-client/xkb/kstoucs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
index 81e71b9b..8471e942 100644
--- a/console-client/xkb/kstoucs.c
+++ b/console-client/xkb/kstoucs.c
@@ -13,8 +13,10 @@ find_ucs (int keysym, struct ksmap *first, struct ksmap *last)
if (middle->keysym == keysym)
return middle->ucs; /* base case: needle found. */
- else if (middle == first && middle == last)
- return 0; /* base case: empty search space. */
+ else if (first == last /* empty search space */
+ || keysym < first->keysym /* lookup failure */
+ || keysym > last->keysym) /* lookup failure */
+ return 0;
/* recursive cases: halve search space. */
else if (middle->keysym < keysym)
return find_ucs (keysym, middle+1, last);