summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-07-07 15:43:08 +0800
committerPeng Wu <alexepico@gmail.com>2014-07-07 15:43:08 +0800
commit5e1ef814ff33081705ea126b83fee6495c4de4bc (patch)
treeef0e2ebe302bf84792ecc8b4bd94dff3f38eff2a /src
parentf37abf8bf0d4566f0e569626861dfaef331a0a03 (diff)
downloadibus-libzhuyin-5e1ef814ff33081705ea126b83fee6495c4de4bc.tar.gz
ibus-libzhuyin-5e1ef814ff33081705ea126b83fee6495c4de4bc.tar.xz
ibus-libzhuyin-5e1ef814ff33081705ea126b83fee6495c4de4bc.zip
fixes crashes
Diffstat (limited to 'src')
-rw-r--r--src/ZYZBuiltinSymbolSection.cc3
-rw-r--r--src/ZYZPhoneticEditor.cc6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/ZYZBuiltinSymbolSection.cc b/src/ZYZBuiltinSymbolSection.cc
index 275739c..b15c985 100644
--- a/src/ZYZBuiltinSymbolSection.cc
+++ b/src/ZYZBuiltinSymbolSection.cc
@@ -40,6 +40,9 @@ bool
BuiltinSymbolSection::initCandidates (zhuyin_instance_t * instance,
const String & lookup)
{
+ if (!lookup)
+ return false;
+
assert (1 == lookup.length ());
m_lookup = lookup;
diff --git a/src/ZYZPhoneticEditor.cc b/src/ZYZPhoneticEditor.cc
index 98369ed..ca33e2b 100644
--- a/src/ZYZPhoneticEditor.cc
+++ b/src/ZYZPhoneticEditor.cc
@@ -171,7 +171,6 @@ PhoneticEditor::processShowCandidateKey (guint keyval, guint keycode,
case IBUS_KP_Down:
/* check phonetic or symbol section here */
prepareCandidates ();
- m_input_state = STATE_CANDIDATE_SHOWN;
break;
case IBUS_Up:
@@ -700,7 +699,7 @@ PhoneticEditor::prepareCandidates (void)
}
/* deal with candidates */
- if (m_cursor != get_enhanced_text_length (enhanced_text)) {
+ if (m_cursor < get_enhanced_text_length (enhanced_text)) {
section_t type = probe_section_quick (enhanced_text, start_pos);
if (PHONETIC_SECTION == type) {
@@ -715,7 +714,8 @@ PhoneticEditor::prepareCandidates (void)
assert (parsed_len <= section_len);
if (cursor >= parsed_len) {
- String lookup = section[cursor];
+ String lookup;
+ lookup += section[cursor];
m_input_state = STATE_BOPOMOFO_SYMBOL_SHOWN;
m_symbol_sections[m_input_state]->initCandidates
(m_instance, lookup);