From 5292829e05a00096f6127e8f194e9587bf16cbab Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 25 Feb 2018 20:22:49 -0500 Subject: [PATCH] Fix edge case GERBER_FILE_IMAGE creation logic --- gerbview/readgerb.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index f3209bf5c5..4e630c05ba 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -45,16 +45,14 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName ) GERBER_FILE_IMAGE_LIST* images = GetImagesList(); GERBER_FILE_IMAGE* gerber = GetGbrImage( layer ); - if( gerber == NULL ) - { - gerber = new GERBER_FILE_IMAGE( layer ); - images->AddGbrImage( gerber, layer ); - } - else + if( gerber != NULL ) { Erase_Current_DrawLayer( false ); } + gerber = new GERBER_FILE_IMAGE( layer ); + images->AddGbrImage( gerber, layer ); + /* Read the gerber file */ bool success = gerber->LoadGerberFile( GERBER_FullFileName );