Protect VIEW against oddball items
Importing may have more view layers than we allocate. In these cases, we need to avoid accidentally writing to unallocated view layers Fixes https://gitlab.com/kicad/code/kicad/issues/13638
This commit is contained in:
parent
0e939993bc
commit
242b9855dd
|
@ -333,6 +333,9 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
|
|||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
{
|
||||
if( layers[i] < 0 || layers[i] >= m_layers.size() )
|
||||
continue;
|
||||
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
l.items->Insert( aItem );
|
||||
MarkTargetDirty( l.target );
|
||||
|
|
Loading…
Reference in New Issue