diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index a04f549248..0c034266b9 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -363,7 +363,8 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent ) while( startLayer != --layer ) { - if( brd->IsLayerVisible( static_cast( layer ) ) && IsCopperLayer( layer ) ) + if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu) + && brd->IsLayerVisible( static_cast( layer ) ) ) break; if( layer <= F_Cu )