Fix coverity error

Check failed to open file before dereferencing
This commit is contained in:
Seth Hillbrand 2021-09-14 10:15:43 -07:00
parent 38e1e780a8
commit 754464cb3b
1 changed files with 4 additions and 3 deletions

View File

@ -2329,13 +2329,14 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
// Open the file and get the file size
FILE* fp = wxFopen( aFileName, wxT( "rt" ) );
fseek( fp, 0L, SEEK_END );
long fileSize = ftell( fp );
rewind( fp );
if( !fp )
THROW_IO_ERROR( wxString::Format( _( "Cannot open file '%s'" ), aFileName ) );
fseek( fp, 0L, SEEK_END );
long fileSize = ftell( fp );
rewind( fp );
DSNLEXER lexer( emptyKeywords, 0, fp, aFileName );
long currentPosition = 0;