API: Do not attempt to unpack invalid layers
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21743
(cherry picked from commit 66628a3501)
Co-authored-by: Jon Evans <[email protected]>
This commit is contained in:
@@ -94,7 +94,9 @@ LSET UnpackLayerSet( const google::protobuf::RepeatedField<int>& aProtoLayerSet
|
||||
wxCHECK2( layer >= F_Cu && layer < PCB_LAYER_ID_COUNT, continue );
|
||||
PCB_LAYER_ID boardLayer =
|
||||
FromProtoEnum<PCB_LAYER_ID>( static_cast<types::BoardLayer>( layer ) );
|
||||
set.set( boardLayer );
|
||||
|
||||
if( boardLayer >= 0 && IsValidLayer( boardLayer ) )
|
||||
set.set( boardLayer );
|
||||
}
|
||||
|
||||
return set;
|
||||
|
||||
Reference in New Issue
Block a user