Fix typo in lib_text layer id

Also adds CHECK_RET to catch similar errors in the future

Fixes https://gitlab.com/kicad/code/kicad/issues/12078
This commit is contained in:
Seth Hillbrand 2022-07-25 17:05:59 -07:00
parent c3d952644c
commit 008b4f583b
2 changed files with 3 additions and 1 deletions

View File

@ -122,6 +122,8 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
for( int i = 0; i < item_layers_count; i++ ) for( int i = 0; i < item_layers_count; i++ )
{ {
wxCHECK_RET( item_layers[i] <= LAYER_ID_COUNT, wxT( "Invalid item layer" ) );
if( layer_item_map.count( item_layers[i] ) == 0 ) if( layer_item_map.count( item_layers[i] ) == 0 )
{ {
layer_item_map.emplace( std::make_pair( item_layers[i], layer_item_map.emplace( std::make_pair( item_layers[i],

View File

@ -49,7 +49,7 @@ void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 2; aCount = 2;
aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE; aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE;
aLayers[2] = LAYER_SELECTION_SHADOWS; aLayers[1] = LAYER_SELECTION_SHADOWS;
} }