FP editor: fix crash when trying to save a footprint (Ctrl+S) when no footprint loaded.

This commit is contained in:
jean-pierre charras 2019-07-19 19:06:16 +02:00
parent b4fc78fc0d
commit 176b1a0fd5
2 changed files with 6 additions and 0 deletions

View File

@ -255,6 +255,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_MODEDIT_SAVE: case ID_MODEDIT_SAVE:
if( !GetBoard()->GetFirstModule() ) // no loaded footprint
break;
if( GetTargetFPID() == GetLoadedFPID() ) if( GetTargetFPID() == GetLoadedFPID() )
{ {
if( SaveFootprint( GetBoard()->GetFirstModule() ) ) if( SaveFootprint( GetBoard()->GetFirstModule() ) )

View File

@ -706,6 +706,9 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString&
bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aModule ) bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aModule )
{ {
if( !aModule ) // Happen if no footprint loaded
return false;
wxString libraryName = aModule->GetFPID().GetLibNickname(); wxString libraryName = aModule->GetFPID().GetLibNickname();
wxString footprintName = aModule->GetFPID().GetLibItemName(); wxString footprintName = aModule->GetFPID().GetLibItemName();
bool nameChanged = m_footprintNameWhenLoaded != footprintName; bool nameChanged = m_footprintNameWhenLoaded != footprintName;