Skip to content

Commit b6e72ed

Browse files
Fixed crash on WriteDREAM3D xdmf file (#921)
* Avoids crashing when writing the xdmf file fails * Reports an error message through the WriteDREAM3DFilter fixes #915
1 parent 956f295 commit b6e72ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Plugins/SimplnxCore/src/SimplnxCore/Filters/WriteDREAM3DFilter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,13 @@ Result<> WriteDREAM3DFilter::executeImpl(DataStructure& dataStructure, const Arg
117117
if(writeXdmf)
118118
{
119119
fs::path xdmfFilePath = exportFilePath.replace_extension(".xdmf");
120-
fs::rename(xdmfFilePath, args.value<fs::path>(k_ExportFilePath).replace_extension(".xdmf"));
120+
std::error_code errorCode;
121+
fs::rename(xdmfFilePath, args.value<fs::path>(k_ExportFilePath).replace_extension(".xdmf"), errorCode);
122+
if(errorCode)
123+
{
124+
std::string ss = fmt::format("Failed to rename xdmf file with error: '{}'", errorCode.message());
125+
return MakeErrorResult(errorCode.value(), ss);
126+
}
121127
}
122128
}
123129
return results;

0 commit comments

Comments
 (0)