summaryrefslogtreecommitdiff
path: root/src/PYPBopomofoEditor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/PYPBopomofoEditor.cc')
-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;