Browse Source

Make sure that we have a visible layer

Before setting the active layer to our visible sequence, make sure that
the sequence is not empty (leads to invalid layer id->crash)

Fixes https://gitlab.com/kicad/code/kicad/issues/11629

(cherry picked from commit 0d93be0af2)
7.0
Seth Hillbrand 4 years ago
parent
commit
b00bf2bc6b
  1. 4
      pcbnew/widgets/appearance_controls.cpp

4
pcbnew/widgets/appearance_controls.cpp

@ -1786,7 +1786,7 @@ void APPEARANCE_CONTROLS::OnLayerContextMenu( wxCommandEvent& aEvent )
{
visible &= ~presetAllCopper.layers;
if( !visible.test( current ) )
if( !visible.test( current ) && visible.count() > 0 )
m_frame->SetActiveLayer( *visible.Seq().begin() );
setVisibleLayers( visible );
@ -1797,7 +1797,7 @@ void APPEARANCE_CONTROLS::OnLayerContextMenu( wxCommandEvent& aEvent )
{
visible &= presetAllCopper.layers;
if( !visible.test( current ) )
if( !visible.test( current ) && visible.count() > 0 )
m_frame->SetActiveLayer( *visible.Seq().begin() );
setVisibleLayers( visible );

Loading…
Cancel
Save