summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-02-27 14:09:35 +0800
committerPeng Wu <alexepico@gmail.com>2017-02-27 14:09:35 +0800
commit758c5b312b36f440224cb6cbe4b363322d98b305 (patch)
tree3937e9507c95d7ed60b815f9b2931bb45ff61696
parentb9e6a9690f214f525e057194b9eb234d76436eda (diff)
downloadlibpinyin-758c5b312b36f440224cb6cbe4b363322d98b305.zip
libpinyin-758c5b312b36f440224cb6cbe4b363322d98b305.tar.gz
libpinyin-758c5b312b36f440224cb6cbe4b363322d98b305.tar.xz
fixes crash
-rw-r--r--src/pinyin.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 1a5132e..57defcc 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1172,6 +1172,9 @@ bool pinyin_get_sentence(pinyin_instance_t * instance,
pinyin_context_t * & context = instance->m_context;
NBestMatchResults & results = instance->m_nbest_results;
+ if (0 == results.size())
+ return false;
+
MatchResult result = NULL;
assert(index < results.size());
assert(results.get_result(index, result));