Fix edge case GERBER_FILE_IMAGE creation logic

This commit is contained in:
Jon Evans 2018-02-25 20:22:49 -05:00 committed by Wayne Stambaugh
parent b03ac1f614
commit 5292829e05
1 changed files with 4 additions and 6 deletions

View File

@ -45,16 +45,14 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
GERBER_FILE_IMAGE_LIST* images = GetImagesList(); GERBER_FILE_IMAGE_LIST* images = GetImagesList();
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer ); GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
if( gerber == NULL ) if( gerber != NULL )
{
gerber = new GERBER_FILE_IMAGE( layer );
images->AddGbrImage( gerber, layer );
}
else
{ {
Erase_Current_DrawLayer( false ); Erase_Current_DrawLayer( false );
} }
gerber = new GERBER_FILE_IMAGE( layer );
images->AddGbrImage( gerber, layer );
/* Read the gerber file */ /* Read the gerber file */
bool success = gerber->LoadGerberFile( GERBER_FullFileName ); bool success = gerber->LoadGerberFile( GERBER_FullFileName );