gerbview: Prevent NULL dereference

There was a possible NULL dereference when executing tool_up even
though we should never hit it, we protect against bad files.

Also converts a couple untranslated error strings.
This commit is contained in:
Seth Hillbrand 2018-10-10 23:11:10 -07:00
parent a16e21665a
commit d03b08a03f
1 changed files with 8 additions and 2 deletions

View File

@ -385,7 +385,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
default:
{
wxString msg;
msg.Printf( wxT( "Unexpected symbol <%c>" ), *text );
msg.Printf( _( "Unexpected symbol <%c>" ), *text );
AddMessageToList( msg );
}
break;
@ -431,7 +431,7 @@ bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text )
if( !cmd )
{
msg.Printf( wxT( "Unknown Excellon command <%s>" ), text );
msg.Printf( _( "Unknown Excellon command <%s>" ), text );
AddMessageToList( msg );
while( *text )
text++;
@ -560,6 +560,12 @@ bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text )
{
D_CODE* tool = GetDCODE( m_Current_Tool );
if( !tool )
{
AddMessageToList( wxString::Format( _( "Got unknown tool code %d" ), m_Current_Tool ) );
break;
}
for( size_t ii = 1; ii < m_RoutePositions.size(); ii++ )
{
GERBER_DRAW_ITEM* gbritem = new GERBER_DRAW_ITEM( this );