FP editor: fix crash when trying to save a footprint (Ctrl+S) when no footprint loaded.
This commit is contained in:
parent
b4fc78fc0d
commit
176b1a0fd5
|
@ -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() ) )
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue