diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 304ed80176..11db9966b5 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -1784,7 +1784,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 ); @@ -1795,7 +1795,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 );