summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-06-17 14:43:40 +0800
committerPeng Wu <alexepico@gmail.com>2013-06-17 14:43:40 +0800
commit46af45028fbb166c3a4be4239b0126db39efd2b4 (patch)
tree5fb1c4adeab50b5cd9108c0cc0536423ceb347aa /utils
parent4f082982bcdb340b58454526da681169cee4fd9f (diff)
downloadlibpinyin-46af45028fbb166c3a4be4239b0126db39efd2b4.zip
libpinyin-46af45028fbb166c3a4be4239b0126db39efd2b4.tar.gz
libpinyin-46af45028fbb166c3a4be4239b0126db39efd2b4.tar.xz
check return values
Diffstat (limited to 'utils')
-rw-r--r--utils/training/prune_k_mixture_model.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/training/prune_k_mixture_model.cpp b/utils/training/prune_k_mixture_model.cpp
index 528d5ce..40dfb87 100644
--- a/utils/training/prune_k_mixture_model.cpp
+++ b/utils/training/prune_k_mixture_model.cpp
@@ -130,7 +130,11 @@ int main(int argc, char * argv[]){
bigram.attach(bigram_filename, ATTACH_READWRITE);
KMixtureModelMagicHeader magic_header;
- bigram.get_magic_header(magic_header);
+ if (!bigram.get_magic_header(magic_header)) {
+ fprintf(stderr, "no magic header in k mixture model.\n");
+ exit(ENODATA);
+ }
+
GArray * items = g_array_new(FALSE, FALSE, sizeof(phrase_token_t));
bigram.get_all_items(items);