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
)
This commit is contained in:
parent
4b668269b7
commit
b00bf2bc6b
|
@ -1786,7 +1786,7 @@ void APPEARANCE_CONTROLS::OnLayerContextMenu( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
visible &= ~presetAllCopper.layers;
|
visible &= ~presetAllCopper.layers;
|
||||||
|
|
||||||
if( !visible.test( current ) )
|
if( !visible.test( current ) && visible.count() > 0 )
|
||||||
m_frame->SetActiveLayer( *visible.Seq().begin() );
|
m_frame->SetActiveLayer( *visible.Seq().begin() );
|
||||||
|
|
||||||
setVisibleLayers( visible );
|
setVisibleLayers( visible );
|
||||||
|
@ -1797,7 +1797,7 @@ void APPEARANCE_CONTROLS::OnLayerContextMenu( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
visible &= presetAllCopper.layers;
|
visible &= presetAllCopper.layers;
|
||||||
|
|
||||||
if( !visible.test( current ) )
|
if( !visible.test( current ) && visible.count() > 0 )
|
||||||
m_frame->SetActiveLayer( *visible.Seq().begin() );
|
m_frame->SetActiveLayer( *visible.Seq().begin() );
|
||||||
|
|
||||||
setVisibleLayers( visible );
|
setVisibleLayers( visible );
|
||||||
|
|
Loading…
Reference in New Issue