Incorrect handling of '0' when displaying a list of candidates
Created by: bochecha
Let's say the user types hi
in Quick (or h*i
in Cangjie). We're giving them a list of candidates.
They can then press a number between 1 and 9 to select a candidate on the currently displayed page.
But what if they type 0?
Here's what happens:
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/ibus_cangjie/engine.py", line 333, in do_process_key_event
return self.do_number(keyval)
File "/usr/lib/python3.4/site-packages/ibus_cangjie/engine.py", line 235, in do_number
return self.do_select_candidate(int(IBus.keyval_to_unicode(keyval)))
File "/usr/lib/python3.4/site-packages/ibus_cangjie/engine.py", line 291, in do_select_candidate
selected = self.lookuptable.get_candidate(page_index+index-1)
OverflowError: -1 not in range 0 to 4294967295
That triggered the ABRT crash catcher in Fedora, and a user was nice enough to report the issue.
Edited by Koala Yeung