From 08b469c70f3ec625ce5186bfcb97763c323e1cc5 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 27 May 2016 15:08:31 +0800 Subject: fixes train_result2 method --- src/lookup/pinyin_lookup2.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/lookup/pinyin_lookup2.cpp b/src/lookup/pinyin_lookup2.cpp index b5ceb86..8d7d525 100644 --- a/src/lookup/pinyin_lookup2.cpp +++ b/src/lookup/pinyin_lookup2.cpp @@ -617,6 +617,8 @@ bool PinyinLookup2::train_result2(PhoneticKeyMatrix * matrix, if (null_token != next_token) break; } + /* safe guard for last token. */ + next_pos = std_lite::min(next_pos, constraints->len - 1); /* train uni-gram */ m_phrase_index->get_phrase_item(token, m_cached_phrase_item); -- cgit