From 6fb731189c314721658a92100f5a9a287399ab00 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 17 Sep 2013 11:51:05 -0400 Subject: [PATCH] Fix two more FPID empty string parsing bugs. --- cvpcb/readwrite_dlgs.cpp | 13 ++++++------- pcbnew/legacy_plugin.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 1096833b90..43d94bbdb5 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -74,17 +74,16 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) // Check to see if the component has already a footprint set. hasFootprint = !component->GetFPID().empty(); -#if defined( USE_FP_LIB_TABLE ) FPID fpid; - wxCHECK_RET( fpid.Parse( aFootprintName ) < 0, - wxString::Format( wxT( "<%s> is not a valid FPID." ), - GetChars( aFootprintName ) ) ); + if( !aFootprintName.IsEmpty() ) + { + wxCHECK_RET( fpid.Parse( aFootprintName ) < 0, + wxString::Format( wxT( "<%s> is not a valid FPID." ), + GetChars( aFootprintName ) ) ); + } component->SetFPID( fpid ); -#else - component->SetFPID( FPID( aFootprintName ) ); -#endif // create the new component description description.Printf( CMP_FORMAT, componentIndex + 1, diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index c03dacbf76..2b8e98fff2 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -278,8 +278,13 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) { auto_ptr module( new MODULE( m_board ) ); + FPID fpid; std::string fpName = StrPurge( line + SZ( "$MODULE" ) ); - module->SetFPID( FPID( fpName ) ); + + if( !fpName.empty() ) + fpid = FPID( fpName ); + + module->SetFPID( fpid ); LoadMODULE( module.get() ); m_board->Add( module.release(), ADD_APPEND );