Anonymous avatar 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 +
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.