diff --git a/core/lib/FileHandling/FFStream.cpp b/core/lib/FileHandling/FFStream.cpp index cc9bfa140..2b6d2769c 100644 --- a/core/lib/FileHandling/FFStream.cpp +++ b/core/lib/FileHandling/FFStream.cpp @@ -114,7 +114,12 @@ namespace gnsstk void FFStream :: init( const char* fn, std::ios::openmode mode ) { - close(); + // close will fail if the stream is not currently open + // This will throw an exception is the fstream is set to + // throw exceptions on failures (exceptions(ifstream::failbit)) + if(is_open()) + close(); + clear(); filename = std::string(fn); recordNumber = 0;