Pcbnew: fix crash when trying to select the previous copper layer.
The function that calculates the previous layer id was using a illegal value in some cases. Fixes #3805 https://gitlab.com/kicad/code/kicad/issues/3805
This commit is contained in:
parent
bc68c7d949
commit
d12e8479f2
|
@ -363,7 +363,8 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
|
|||
|
||||
while( startLayer != --layer )
|
||||
{
|
||||
if( brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) && IsCopperLayer( layer ) )
|
||||
if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu)
|
||||
&& brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) )
|
||||
break;
|
||||
|
||||
if( layer <= F_Cu )
|
||||
|
|
Loading…
Reference in New Issue