summaryrefslogtreecommitdiffstats
path: root/src/ZYZPhoneticSection.cc
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-07-14 13:00:48 +0800
committerPeng Wu <alexepico@gmail.com>2014-07-14 13:00:48 +0800
commitd4b7aa31a0261af21c8cdf36717119175280ca76 (patch)
treee0c062b40c865df3cc23696f3ffd63a8fe439858 /src/ZYZPhoneticSection.cc
parent0de259f2382df739af096ac07728ec7a2dd2b6ae (diff)
downloadibus-libzhuyin-d4b7aa31a0261af21c8cdf36717119175280ca76.tar.gz
ibus-libzhuyin-d4b7aa31a0261af21c8cdf36717119175280ca76.tar.xz
ibus-libzhuyin-d4b7aa31a0261af21c8cdf36717119175280ca76.zip
fixes method selectCandidate
Diffstat (limited to 'src/ZYZPhoneticSection.cc')
-rw-r--r--src/ZYZPhoneticSection.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ZYZPhoneticSection.cc b/src/ZYZPhoneticSection.cc
index a240a68..99d6213 100644
--- a/src/ZYZPhoneticSection.cc
+++ b/src/ZYZPhoneticSection.cc
@@ -101,6 +101,12 @@ PhoneticSection::selectCandidate (guint index)
guint16 prev_pos = m_cursor, cur_pos = 0;
ChewingKeyRest * key_rest = NULL;
+ guint len = 0;
+ zhuyin_get_n_candidate (m_instance, &len);
+
+ if (index >= len)
+ return 0;
+
lookup_candidate_t * candidate = NULL;
zhuyin_get_candidate (m_instance, index, &candidate);
@@ -111,7 +117,6 @@ PhoneticSection::selectCandidate (guint index)
offset = zhuyin_choose_candidate
(m_instance, offset, candidate);
- guint len = 0;
zhuyin_get_n_zhuyin (m_instance, &len);
if (offset < len) {