Commits

Anonymous committed 7cc24a6

stream should be checked for failing state before passing
it into the loading function of a DAWG object

Comments (0)

Files changed (2)

 
         cdef ifstream stream
         stream.open(path, iostream.binary)
+        if stream.fail():
+            raise IOError("It's not possible to read file stream")
 
         res = self.dct.Read(<istream*> &stream)
 
 
         cdef ifstream stream
         stream.open(path, iostream.binary)
+        if stream.fail():
+            raise IOError("It's not possible to read file stream")
 
         try:
             res = self.dct.Read(<istream*> &stream)
 from libcpp.string cimport string
+from libcpp cimport bool
 
 cdef extern from "<istream>" namespace "std" nogil:
     cdef cppclass istream:
         istream(char* filename) except +
         istream(char* filename, int mode) except +
 
+        bool fail() except +
+
         void open(char* filename) except +
         void open(char* filename, int mode) except +
         void close() except +