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:06:48 +0800
commit93e8e69073840600d701bdd37067cbbc0afa23a8 (patch)
treee0a5b2a8478bc9dd8b4aa610cdbc6535dc2e963c
parentd92850fa529561d8e3cb9dfdc28a6280ce3fc81a (diff)
downloadlibpinyin-93e8e69073840600d701bdd37067cbbc0afa23a8.zip
libpinyin-93e8e69073840600d701bdd37067cbbc0afa23a8.tar.gz
libpinyin-93e8e69073840600d701bdd37067cbbc0afa23a8.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;