summaryrefslogtreecommitdiffstats
path: root/src/storage/phrase_index.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-10-08 13:51:37 +0800
committerPeng Wu <alexepico@gmail.com>2012-10-08 13:51:37 +0800
commitb999e8758ccdc340eeb8204b3cf2a9cdacccfc31 (patch)
tree6c7745ba03a55f6f1e0fd97fb908f26c9767f359 /src/storage/phrase_index.cpp
parent4e024b971a013799ddd201011aca30a94870a46e (diff)
downloadlibpinyin-b999e8758ccdc340eeb8204b3cf2a9cdacccfc31.tar.gz
libpinyin-b999e8758ccdc340eeb8204b3cf2a9cdacccfc31.tar.xz
libpinyin-b999e8758ccdc340eeb8204b3cf2a9cdacccfc31.zip
detect corrupted phrase index log file
Diffstat (limited to 'src/storage/phrase_index.cpp')
-rw-r--r--src/storage/phrase_index.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp
index 64eb649..0424b3a 100644
--- a/src/storage/phrase_index.cpp
+++ b/src/storage/phrase_index.cpp
@@ -361,7 +361,11 @@ bool SubPhraseIndex::merge(PhraseIndexLogger * logger){
PhraseItem olditem, newitem, item, * tmpitem;
while(logger->has_next_record()){
- logger->next_record(log_type, token, &oldchunk, &newchunk);
+ bool retval = logger->next_record
+ (log_type, token, &oldchunk, &newchunk);
+
+ if (!retval)
+ break;
switch(log_type){
case LOG_ADD_RECORD:{