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:
Seth Hillbrand 2023-01-26 11:21:28 -08:00
parent 0e939993bc
commit 242b9855dd
1 changed files with 3 additions and 0 deletions

View File

@ -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 );