Skip to content

Commit

Permalink
Merge topic 'fix-exodus-crash'
Browse files Browse the repository at this point in the history
8f73971 Opening a non-existent filename should not crash.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: T.J. Corona <tj.corona@kitware.com>
Merge-request: !4866
  • Loading branch information
vibraphone authored and kwrobot committed Nov 3, 2018
2 parents ab258f5 + 8f73971 commit b81e364
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions IO/Exodus/vtkExodusIIReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3847,6 +3847,12 @@ int vtkExodusIIReaderPrivate::OpenFile( const char* filename )

this->Exoid = ex_open( filename, EX_READ,
&this->AppWordSize, &this->DiskWordSize, &this->ExodusVersion );
if ( this->Exoid <= 0 )
{
vtkErrorMacro( "Unable to open \"" << filename << "\" for reading" );
return 0;
}

#ifdef VTK_USE_64BIT_IDS
// Set the exodus API to always return integer types as 64-bit
// without this call, large exodus files are not supported (which
Expand All @@ -3860,12 +3866,6 @@ int vtkExodusIIReaderPrivate::OpenFile( const char* filename )
// in the ex_set_max_name_length() function.
ex_set_max_name_length(this->Exoid, this->Parent->GetMaxNameLength());

if ( this->Exoid <= 0 )
{
vtkErrorMacro( "Unable to open \"" << filename << "\" for reading" );
return 0;
}

vtkIdType numNodesInFile;
char dummyChar;
float dummyFloat;
Expand Down

0 comments on commit b81e364

Please sign in to comment.