From 36ef85182a682e35a1a7ba7d79292c69fa184b38 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 18 Feb 2013 14:36:13 +0800 Subject: [PATCH] fixes crash --- src/storage/phrase_index.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index 3df14f5..5904549 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -564,6 +564,13 @@ int SubPhraseIndex::get_range(/* out */ PhraseIndexRange & range){ const table_offset_t * begin = (const table_offset_t *)m_phrase_index.begin(); const table_offset_t * end = (const table_offset_t *)m_phrase_index.end(); + if (begin == end) { + /* skip empty sub phrase index. */ + range.m_range_begin = 1; + range.m_range_end = 1; + return ERROR_OK; + } + /* remove trailing zeros. */ const table_offset_t * poffset = 0; for (poffset = end - 1; poffset >= begin + 1; --poffset) { -- 2.7.4