Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'phrase-extract/extract-mixed-syntax/gzfilebuf.h')
-rw-r--r--phrase-extract/extract-mixed-syntax/gzfilebuf.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/phrase-extract/extract-mixed-syntax/gzfilebuf.h b/phrase-extract/extract-mixed-syntax/gzfilebuf.h
index b5b0ce87f..4c818ddbb 100644
--- a/phrase-extract/extract-mixed-syntax/gzfilebuf.h
+++ b/phrase-extract/extract-mixed-syntax/gzfilebuf.h
@@ -1,6 +1,7 @@
#ifndef moses_gzfile_buf_h
#define moses_gzfile_buf_h
+#include <stdexcept>
#include <streambuf>
#include <zlib.h>
#include <cstring>
@@ -10,7 +11,8 @@ class gzfilebuf : public std::streambuf
public:
gzfilebuf(const char *filename) {
_gzf = gzopen(filename, "rb");
- setg (_buff+sizeof(int), // beginning of putback area
+ if (!_gzf)
+ throw std::runtime_error("Could not open " + std::string(filename) + "."); setg (_buff+sizeof(int), // beginning of putback area
_buff+sizeof(int), // read position
_buff+sizeof(int)); // end position
}