summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-04-10 10:48:36 +0800
committerPeng Wu <alexepico@gmail.com>2012-04-10 10:48:36 +0800
commit7a2b74326e066f4672207199971c9ce41dc31a39 (patch)
tree5796b21ccf58441826905acfe0479e0b5a64b99d
parent0ff6dabf0a1c0e5678487d8d273b21e2a1c65ff0 (diff)
downloadibus-libpinyin-7a2b74326e066f4672207199971c9ce41dc31a39.tar.gz
fixes commit in bopomofo editor
-rw-r--r--src/PYPBopomofoEditor.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc
index c3b0402..460fed6 100644
--- a/src/PYPBopomofoEditor.cc
+++ b/src/PYPBopomofoEditor.cc
@@ -260,12 +260,14 @@ LibPinyinBopomofoEditor::commit ()
/* sentence candidate */
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);
}
- g_free (tmp);
/* text after pinyin */
const gchar *p = m_text.c_str() + m_pinyin_len;