diff options
author | Peng Wu <alexepico@gmail.com> | 2016-05-19 16:55:53 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-05-19 16:55:53 +0800 |
commit | 1d133308fc6bdc47432a379473f3bb199af78f4c (patch) | |
tree | 80cbc293896b74e0e6c43d3e466cab7eb08645a2 /src/storage/phonetic_key_matrix.cpp | |
parent | 6fb0d50ded3f1666159bb713d381ab269d11e21d (diff) | |
download | libpinyin-1d133308fc6bdc47432a379473f3bb199af78f4c.tar.gz libpinyin-1d133308fc6bdc47432a379473f3bb199af78f4c.tar.xz libpinyin-1d133308fc6bdc47432a379473f3bb199af78f4c.zip |
fixes again
Diffstat (limited to 'src/storage/phonetic_key_matrix.cpp')
-rw-r--r-- | src/storage/phonetic_key_matrix.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp index bd48f38..eb72410 100644 --- a/src/storage/phonetic_key_matrix.cpp +++ b/src/storage/phonetic_key_matrix.cpp @@ -223,9 +223,22 @@ int search_matrix_recur(GArray * cached_keys, const ChewingKeyRest key_rest = g_array_index(key_rests, ChewingKeyRest, i); + size_t newstart = key_rest.m_raw_end; + + const ChewingKey zero_key; + if (zero_key == key) { + /* assume only one key here. */ + assert(1 == keys->len); + + g_array_free(keys, TRUE); + g_array_free(key_rests, TRUE); + + return search_matrix_recur(cached_keys, table, matrix, + newstart, end, ranges, longest); + } + /* push value */ g_array_append_val(cached_keys, key); - size_t newstart = key_rest.m_raw_end; longest = std_lite::max(longest, newstart); result |= search_matrix_recur(cached_keys, table, matrix, |