Prevent crash when appearance panel defines no view presets.

This commit is contained in:
Jeff Young 2020-08-19 23:46:57 +01:00
parent cffbc34f12
commit 21a9f2ecfe
1 changed files with 14 additions and 11 deletions

View File

@ -46,7 +46,8 @@ PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
PCB_BASE_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
m_rotationAngle( 900 ), m_undoRedoBlocked( false ),
m_Layers( nullptr ),
m_selectionFilterPanel( nullptr )
m_selectionFilterPanel( nullptr ),
m_appearancePanel( nullptr )
{
if( !GFootprintList.GetCount() )
{
@ -83,9 +84,10 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
static bool s_switcherShown = false;
if( !s_switcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && wxGetKeyState( WXK_TAB ) )
{
if( m_appearancePanel )
{
const wxArrayString& mru = m_appearancePanel->GetLayerPresetsMRU();
EDA_VIEW_SWITCHER switcher( this, mru );
s_switcherShown = true;
@ -99,6 +101,7 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
return true;
}
}
return PCB_BASE_FRAME::TryBefore( aEvent );
}