Fix Eeschema: Part library editor "save current library as" crash if no current library selected.
Fixes: lp:1678698 https://bugs.launchpad.net/kicad/+bug/1678698
This commit is contained in:
parent
2f9be81b19
commit
1f3fe6fefb
|
@ -291,10 +291,11 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
void LIB_EDIT_FRAME::OnSaveActiveLibrary( wxCommandEvent& event )
|
||||
{
|
||||
bool newFile = false;
|
||||
|
||||
if( event.GetId() == ID_LIBEDIT_SAVE_CURRENT_LIB_AS )
|
||||
newFile = true;
|
||||
|
||||
this->SaveActiveLibrary( newFile );
|
||||
SaveActiveLibrary( newFile );
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,15 +308,15 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
|
|||
|
||||
PART_LIB* lib = GetCurLib();
|
||||
|
||||
// Just in case the library hasn't been cached yet.
|
||||
lib->GetCount();
|
||||
|
||||
if( !lib )
|
||||
{
|
||||
DisplayError( this, _( "No library specified." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Just in case the library hasn't been cached yet.
|
||||
lib->GetCount();
|
||||
|
||||
wxString oldFileName = lib->GetFullFileName();
|
||||
|
||||
if( GetScreen()->IsModify() )
|
||||
|
|
|
@ -166,6 +166,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_UPDATE_UI( wxID_UNDO, LIB_EDIT_FRAME::OnUpdateUndo )
|
||||
EVT_UPDATE_UI( wxID_REDO, LIB_EDIT_FRAME::OnUpdateRedo )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::OnUpdateSaveCurrentLib )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_CURRENT_LIB_AS, LIB_EDIT_FRAME::OnUpdateSaveCurrentLib )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_VIEW_DOC, LIB_EDIT_FRAME::OnUpdateViewDoc )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_EDIT_PIN_BY_PIN, LIB_EDIT_FRAME::OnUpdatePinByPin )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_EDIT_PIN_BY_TABLE, LIB_EDIT_FRAME::OnUpdatePinTable )
|
||||
|
|
Loading…
Reference in New Issue