vtkXdmfWriter Crash when field data of type vtkStringArray is present in the dataset
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
if a vtkStringArray is present in the dataset the XdmfWriter crash in the line : vtkWdmfWriter.cxx:1004, because we try to convert a vtkAbstractArray into a vtkDataArray.
the patch is simple, just test if is a valid pointer :
diff --git a/IO/Xdmf2/vtkXdmfWriter.cxx b/IO/Xdmf2/vtkXdmfWriter.cxx index a186bb4..716a016 100644 --- a/IO/Xdmf2/vtkXdmfWriter.cxx +++ b/IO/Xdmf2/vtkXdmfWriter.cxx @@ -1002,7 +1002,7 @@ void vtkXdmfWriter::WriteArrays(vtkFieldData* fd, XdmfGrid *grid, int associatio std::vectorstd::string AttributeNames; for (int i=0; iGetNumberOfArrays(); i++) { vtkDataArray *scalars = fd->GetArray(i);
-
AttributeNames.push_back(scalars->GetName());
-
if(scalars) AttributeNames.push_back(scalars->GetName());
Edited by Julien Fausty