diff options
| author | Peng Wu <alexepico@gmail.com> | 2011-10-08 19:01:16 +0800 |
|---|---|---|
| committer | Peng Wu <alexepico@gmail.com> | 2011-12-22 12:23:14 +0800 |
| commit | c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c (patch) | |
| tree | 4ffa787d8d795e43e204d6dfe3df82e1180ec2ce /src | |
| parent | 68542b98d00d853e4a697a037905e10bc4671d5d (diff) | |
fixes update preedit text
Diffstat (limited to 'src')
| -rw-r--r-- | src/PYPBopomofoEditor.cc | 14 | ||||
| -rw-r--r-- | src/PYPPinyinEditor.cc | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc index 1a330cc..185fdb3 100644 --- a/src/PYPBopomofoEditor.cc +++ b/src/PYPBopomofoEditor.cc @@ -311,13 +311,15 @@ LibPinyinBopomofoEditor::updatePreeditText () m_buffer.clear (); char *tmp = NULL; pinyin_get_sentence(m_instance, &tmp); - if (m_props.modeSimp ()) { - m_buffer<<tmp; - } else { - SimpTradConverter::simpToTrad (tmp, m_buffer); + if (tmp) { + if (m_props.modeSimp ()) { + m_buffer<<tmp; + } else { + SimpTradConverter::simpToTrad (tmp, m_buffer); + } + g_free (tmp); + tmp = NULL; } - g_free (tmp); - tmp = NULL; /* append rest text */ const gchar *p = m_text.c_str () + m_pinyin_len; diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc index 817f621..3d7deff 100644 --- a/src/PYPPinyinEditor.cc +++ b/src/PYPPinyinEditor.cc @@ -242,13 +242,15 @@ LibPinyinPinyinEditor::updatePreeditText () m_buffer.clear (); char *tmp = NULL; pinyin_get_sentence(m_instance, &tmp); - if (m_props.modeSimp ()) { - m_buffer<<tmp; - } else { - SimpTradConverter::simpToTrad (tmp, m_buffer); + if (tmp) { + if (m_props.modeSimp ()) { + m_buffer<<tmp; + } else { + SimpTradConverter::simpToTrad (tmp, m_buffer); + } + g_free (tmp); + tmp = NULL; } - g_free (tmp); - tmp = NULL; /* append rest text */ const gchar *p = m_text.c_str () + m_pinyin_len; |
