diff --git a/src/storm/storage/dd/sylvan/InternalSylvanAdd.cpp b/src/storm/storage/dd/sylvan/InternalSylvanAdd.cpp index 2eddadd3a..5a3cdc954 100644 --- a/src/storm/storage/dd/sylvan/InternalSylvanAdd.cpp +++ b/src/storm/storage/dd/sylvan/InternalSylvanAdd.cpp @@ -803,16 +803,26 @@ namespace storm { void InternalAdd::exportToDot(std::string const& filename, std::vector const&, bool) const { // Open the file, dump the DD and close it again. FILE* filePointer = fopen(filename.c_str() , "a+"); - this->sylvanMtbdd.PrintDot(filePointer); - fclose(filePointer); + // fopen returns a nullptr on failure + if (filePointer == nullptr) { + STORM_LOG_ERROR("Failure to open file: " << filename); + } else { + this->sylvanMtbdd.PrintDot(filePointer); + fclose(filePointer); + } } template void InternalAdd::exportToText(std::string const& filename) const { // Open the file, dump the DD and close it again. FILE* filePointer = fopen(filename.c_str() , "a+"); - this->sylvanMtbdd.PrintText(filePointer); - fclose(filePointer); + // fopen returns a nullptr on failure + if (filePointer == nullptr) { + STORM_LOG_ERROR("Failure to open file: " << filename); + } else { + this->sylvanMtbdd.PrintText(filePointer); + fclose(filePointer); + } } template