Commit c77360d2 authored by Brad King's avatar Brad King
Browse files

vtkPNrrdReader: Fix crash when MPI is not initialized

If the reader is created without MPI initialized then no Controller is
available.  This can happen when vtkNrrdReader::New() returns a
vtkPNrrdReader through the object factory in a non-MPI process.  When no
controller is available fail gracefully rather than crashing.

Change-Id: Icc9a7c0b6f57b921db6e92b3bcc7d68e649261b0
parent b4a3b77b
......@@ -533,6 +533,12 @@ void vtkPNrrdReader::ExecuteDataWithInformation(vtkDataObject *output,
int vtkPNrrdReader::ReadHeader()
if (!this->Controller)
vtkErrorMacro(<< "No MPI Controller available.");
return 0;
VTK_CREATE(vtkCharArray, headerBuffer);
// Read the header on process 0 and broadcast to everyone else.
if (this->Controller->GetLocalProcessId() == 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment