summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-01-29 11:06:48 +0800
committerPeng Wu <alexepico@gmail.com>2012-01-29 11:09:32 +0800
commit06668708392d044b0656b5f8e7569c71c169fb16 (patch)
treef60ada57e82b5242795ccd7e9069ea9c3d71dda3
parentb54a7e1600ba00d9886a0d17b0f923e40cf9672c (diff)
downloadlibpinyin-06668708392d044b0656b5f8e7569c71c169fb16.zip
libpinyin-06668708392d044b0656b5f8e7569c71c169fb16.tar.gz
libpinyin-06668708392d044b0656b5f8e7569c71c169fb16.tar.xz
fixes parse one key
-rw-r--r--src/storage/pinyin_parser2.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 4ab36aa..0437440 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -582,6 +582,9 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
charid = ch == ';' ? 26 : ch - 'a';
/* first yunmu */
const char * yun = m_yunmu_table[charid].m_yunmus[0];
+ if (NULL == yun)
+ return false;
+
gchar * pinyin = g_strdup_printf("%s%s", sheng, yun);
if (search_pinyin_index(options, pinyin, key)) {
key.m_tone = tone;
@@ -592,6 +595,9 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
/* second yunmu */
yun = m_yunmu_table[charid].m_yunmus[1];
+ if (NULL == yun)
+ return false;
+
pinyin = g_strdup_printf("%s%s", sheng, yun);
if (search_pinyin_index(options, pinyin, key)) {
key.m_tone = tone;