diff --git a/src/storm-parsers/parser/PrismParser.cpp b/src/storm-parsers/parser/PrismParser.cpp index ecbb946c7..70ac58af2 100644 --- a/src/storm-parsers/parser/PrismParser.cpp +++ b/src/storm-parsers/parser/PrismParser.cpp @@ -28,6 +28,10 @@ namespace storm { try { std::string fileContent((std::istreambuf_iterator(inputFileStream)), (std::istreambuf_iterator())); result = parseFromString(fileContent, filename, prismCompatibility); + } catch(storm::exceptions::WrongFormatException& e) { + // In case of an exception properly close the file before passing exception. + storm::utility::closeFile(inputFileStream); + throw e; } catch(std::exception& e) { // In case of an exception properly close the file before passing exception. storm::utility::closeFile(inputFileStream); diff --git a/src/storm/storage/prism/Module.cpp b/src/storm/storage/prism/Module.cpp index 1c11addd2..4f141e1aa 100644 --- a/src/storm/storage/prism/Module.cpp +++ b/src/storm/storage/prism/Module.cpp @@ -6,7 +6,7 @@ namespace storm { namespace prism { - Module::Module(std::string const& moduleName, std::vector const& booleanVariables, std::vector const& integerVariables, std::vector const& clockVariables, storm::expressions::Expression const& invariant, std::vector const& commands, std::string const& filename, uint_fast64_t lineNumber) : Module(moduleName, booleanVariables, integerVariables, clockVariables, invariant, commands, "", std::map(), filename, lineNumber) { + Module::Module(std::string const& moduleName, std::vector const& booleanVariables, std::vector const& integerVariables, std::vector const& clockVariables, storm::expressions::Expression const& invariant, std::vector const& commands, std::string const& filename, uint_fast64_t lineNumber) : Module(moduleName, booleanVariables, integerVariables, clockVariables, invariant, commands, "", storm::prism::ModuleRenaming(), filename, lineNumber) { // Intentionally left empty. }