Gerbview: Fix a crash Don't try to close an empty polygon on G37 command.

Can happens with malformed Gerber files.
From Master, commit 528ebf8.
This commit is contained in:
jean-pierre charras 2020-05-07 09:55:13 +02:00
parent d871a92d1c
commit 97dea6ede5
1 changed files with 4 additions and 1 deletions

View File

@ -554,7 +554,10 @@ bool GERBER_FILE_IMAGE::Execute_G_Command( char*& text, int G_command )
if( m_Exposure && GetItemsList() ) // End of polygon
{
GERBER_DRAW_ITEM * gbritem = m_Drawings.GetLast();
gbritem->m_Polygon.Append( gbritem->m_Polygon.Vertex( 0 ) );
if( gbritem->m_Polygon.VertexCount() )
gbritem->m_Polygon.Append( gbritem->m_Polygon.Vertex( 0 ) );
StepAndRepeatItem( *gbritem );
}
m_Exposure = false;