From 46af45028fbb166c3a4be4239b0126db39efd2b4 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 17 Jun 2013 14:43:40 +0800 Subject: check return values --- utils/training/prune_k_mixture_model.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'utils') 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); -- cgit