summaryrefslogtreecommitdiffstats
path: root/src/lookup
diff options
context:
space:
mode:
Diffstat (limited to 'src/lookup')
-rw-r--r--src/lookup/pinyin_lookup2.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lookup/pinyin_lookup2.cpp b/src/lookup/pinyin_lookup2.cpp
index c6686e0..24c0fee 100644
--- a/src/lookup/pinyin_lookup2.cpp
+++ b/src/lookup/pinyin_lookup2.cpp
@@ -282,6 +282,9 @@ bool PinyinLookup2::get_best_match(TokenVector prefixes,
bool PinyinLookup2::search_unigram2(GPtrArray * topresults, int nstep,
PhraseIndexRanges ranges) {
+ if (0 == topresults->len)
+ return false;
+
lookup_value_t * max = (lookup_value_t *)
g_ptr_array_index(topresults, 0);
@@ -298,6 +301,7 @@ bool PinyinLookup2::search_unigram2(GPtrArray * topresults, int nstep,
for ( size_t m = 0; m < PHRASE_INDEX_LIBRARY_COUNT; ++m){
GArray * array = ranges[m];
if ( !array ) continue;
+
for ( size_t n = 0; n < array->len; ++n){
PhraseIndexRange * range = &g_array_index(array, PhraseIndexRange, n);
for ( phrase_token_t token = range->m_range_begin;