mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Avoid unmapped layers
ViewGetLayers returns the item layer even if it is invalid. We filter this out at the base and skip items that cannot be displayed in the view. Fixes https://gitlab.com/kicad/code/kicad/-/issues/21368 (cherry picked from commit d538f8d848798f3905ab9664df7e28cf79a1271b)
This commit is contained in:
parent
e7eedc7567
commit
21ed7a0641
@ -313,6 +313,15 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
|
||||
aItem->m_viewPrivData->m_cachedIndex = m_allItems->size();
|
||||
|
||||
std::vector<int> layers = aItem->ViewGetLayers();
|
||||
|
||||
std::erase_if( layers, []( int layer )
|
||||
{
|
||||
return layer < 0 || layer >= VIEW_MAX_LAYERS;
|
||||
} );
|
||||
|
||||
if( layers.empty() )
|
||||
return;
|
||||
|
||||
aItem->viewPrivData()->saveLayers( layers );
|
||||
|
||||
m_allItems->push_back( aItem );
|
||||
|
Loading…
x
Reference in New Issue
Block a user