summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-05-10 13:12:36 +0800
committerPeng Wu <alexepico@gmail.com>2011-05-10 13:12:36 +0800
commitc7c8dda99cdf334803b72da07d8389e19cf365d8 (patch)
tree2f0ece1b4e655c3dd55bf9817a0baf040d989953
parent54eb877f6df998eaabb397caed32cab760edbb9b (diff)
downloadlibpinyin-c7c8dda99cdf334803b72da07d8389e19cf365d8.tar.gz
libpinyin-c7c8dda99cdf334803b72da07d8389e19cf365d8.tar.xz
libpinyin-c7c8dda99cdf334803b72da07d8389e19cf365d8.zip
fixes a typo in the load method of flexible ngram
-rw-r--r--src/storage/flexible_ngram.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/storage/flexible_ngram.h b/src/storage/flexible_ngram.h
index e5a086b..83cf439 100644
--- a/src/storage/flexible_ngram.h
+++ b/src/storage/flexible_ngram.h
@@ -351,9 +351,11 @@ public:
DBT db_data;
memset(&db_data, 0, sizeof(DBT));
int ret = m_db->get(m_db, NULL, &db_key, &db_data, 0);
- if ( ret == 0)
- single_gram = new FlexibleSingleGram<ArrayHeader, ArrayItem>
- (db_data.data, db_data.size);
+ if ( ret != 0)
+ return false;
+
+ single_gram = new FlexibleSingleGram<ArrayHeader, ArrayItem>
+ (db_data.data, db_data.size);
return true;
}