Footprint viewer: fix a crash when clicking the "Insert footprint in board" tool when no footprint selected
This commit is contained in:
parent
18593d2dbb
commit
51bfec8ef9
|
@ -96,6 +96,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
|
|||
|
||||
EVT_UPDATE_UI( ID_ON_GRID_SELECT, FOOTPRINT_VIEWER_FRAME::OnUpdateSelectGrid )
|
||||
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, FOOTPRINT_VIEWER_FRAME::OnUpdateSelectZoom )
|
||||
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton )
|
||||
|
||||
// listbox events
|
||||
EVT_LISTBOX( ID_MODVIEW_LIB_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnLibList )
|
||||
|
@ -479,7 +480,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& event )
|
|||
|
||||
Close( true );
|
||||
}
|
||||
else
|
||||
else if( GetBoard()->m_Modules )
|
||||
{
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
|
||||
|
||||
|
@ -608,6 +609,12 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Enable( GetBoard()->m_Modules != nullptr );
|
||||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent )
|
||||
{
|
||||
if( aFootprint && !aFootprint->IsEmpty() )
|
||||
|
|
|
@ -75,6 +75,11 @@ public:
|
|||
*/
|
||||
void ReCreateLibraryList();
|
||||
|
||||
/**
|
||||
* Update the ID_ADD_FOOTPRINT_TO_BOARD tool state in main toolbar
|
||||
*/
|
||||
void OnUpdateFootprintButton( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function ShowModal
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue