Blob Blame History Raw
diff --git a/src/include/memory_chunk.h b/src/include/memory_chunk.h
index 83b8ad9..044fa0d 100644
--- a/src/include/memory_chunk.h
+++ b/src/include/memory_chunk.h
@@ -60,7 +60,7 @@ private:
     char * m_allocated; //one data pass the end.
     free_func_t m_free_func;
 
-    const guint32 header = sizeof(guint32) * 2;
+    const gint32 header = sizeof(guint32) * 2;
 
 private:
     void freemem(){
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));