diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index b7cab9e14d..54daadb3e8 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/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 );