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/PYPPinyinEditor.cc | |
parent | 68542b98d00d853e4a697a037905e10bc4671d5d (diff) | |
download | ibus-libpinyin-c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c.tar.gz ibus-libpinyin-c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c.tar.xz ibus-libpinyin-c8ca05ddaeb49f990ce486ad66b2d0eb84c57b7c.zip |
fixes update preedit text
Diffstat (limited to 'src/PYPPinyinEditor.cc')
-rw-r--r-- | src/PYPPinyinEditor.cc | 14 |
1 files changed, 8 insertions, 6 deletions
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; |