summaryrefslogtreecommitdiffstats
path: root/src/PYPBopomofoEditor.cc
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-10-08 19:01:16 +0800
committerPeng Wu <alexepico@gmail.com>2011-12-22 12:23:14 +0800
commitc8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c (patch)
tree4ffa787d8d795e43e204d6dfe3df82e1180ec2ce /src/PYPBopomofoEditor.cc
parent68542b98d00d853e4a697a037905e10bc4671d5d (diff)
downloadibus-libpinyin-c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c.tar.gz
ibus-libpinyin-c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c.tar.xz
ibus-libpinyin-c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c.zip
fixes update preedit text
Diffstat (limited to 'src/PYPBopomofoEditor.cc')
-rw-r--r--src/PYPBopomofoEditor.cc14
1 files changed, 8 insertions, 6 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;