Commit 97a5ed44 authored by Bill Lorensen's avatar Bill Lorensen
Browse files

ERR: Was not checking for null FileName.

parent a9a369b8
......@@ -132,6 +132,12 @@ void vtkSLCReader::ExecuteInformation()
vtkStructuredPoints *output = this->GetOutput();
if (!this->FileName)
{
vtkErrorMacro(<<"A FileName must be specified.");
return;
}
// Initialize
if ((fp = fopen(this->FileName, "rb")) == NULL)
{
......@@ -199,6 +205,12 @@ void vtkSLCReader::Execute()
vtkStructuredPoints *output = this->GetOutput();
if (!this->FileName)
{
vtkErrorMacro(<<"A FileName must be specified.");
return;
}
// Initialize
if ((fp = fopen(this->FileName, "rb")) == NULL)
{
......
......@@ -110,6 +110,12 @@ void vtkSTLReader::Execute()
vtkCellArray *newPolys, *mergedPolys;
vtkPolyData *output = this->GetOutput();
if (!this->FileName)
{
vtkErrorMacro(<<"A FileName must be specified.");
return;
}
//
// Initialize
//
......
......@@ -111,7 +111,10 @@ void vtkBMPReader::ExecuteInformation()
}
this->ComputeInternalFileName(this->DataExtent[4]);
if (this->InternalFileName == NULL)
{
return;
}
// get the magic number by reading in a file
fp = fopen(this->InternalFileName,"rb");
if (!fp)
......@@ -489,6 +492,11 @@ static void vtkBMPReaderUpdate2(vtkBMPReader *self, vtkImageData *data,
// are assumed to be the same as the file extent/order.
void vtkBMPReader::Execute(vtkImageData *data)
{
if (this->InternalFileName == NULL)
{
vtkErrorMacro(<< "Either a FileName or FilePrefix must be specified.");
return;
}
this->ComputeDataIncrements();
// Call the correct templated function for the output
......
......@@ -153,6 +153,12 @@ void vtkImageReader::ComputeInternalFileName(int slice)
}
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return;
}
// make sure we figure out a filename to open
if (this->FileName)
{
......@@ -536,6 +542,12 @@ void vtkImageReader::ComputeDataIncrements()
void vtkImageReader::OpenFile()
{
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return;
}
// Close file from any previous image
if (this->File)
{
......@@ -567,6 +579,11 @@ int vtkImageReader::GetHeaderSize()
int vtkImageReader::GetHeaderSize(int idx)
{
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return 0;
}
if ( ! this->ManualHeaderSize)
{
this->ComputeDataIncrements();
......@@ -589,6 +606,11 @@ void vtkImageReader::OpenAndSeekFile(int dataExtent[6], int idx)
{
unsigned long streamStart;
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return;
}
this->ComputeInternalFileName(idx);
this->OpenFile();
......@@ -843,6 +865,12 @@ void vtkImageReader::Execute(vtkImageData *data)
void *ptr = NULL;
int *ext;
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return;
}
ext = data->GetExtent();
vtkDebugMacro("Reading extent: " << ext[0] << ", " << ext[1] << ", "
......
......@@ -127,6 +127,12 @@ void vtkPNMReader::ExecuteInformation()
this->DataExtent[5] = this->DataVOI[5];
}
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return;
}
// Allocate the space for the filename
this->ComputeInternalFileName(this->DataExtent[4]);
......
......@@ -186,6 +186,12 @@ void vtkTIFFReader::ExecuteInformation()
int numComp, bpp;
int numSlices = 1;
if (!this->FileName && !this->FilePrefix)
{
vtkErrorMacro(<<"Either a FileName or FilePrefix must be specified.");
return;
}
// if the user has not set the extent, but has set the VOI
// set the zaxis extent to the VOI z axis
if (this->DataExtent[4]==0 && this->DataExtent[5] == 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