PNS: Protect drag from null deref

Items that do not have nets will not be in the index, so we need to
avoid the null pointer when adding drag tagets

Fixes https://gitlab.com/kicad/code/kicad/issues/4009
This commit is contained in:
Seth Hillbrand 2020-03-06 09:30:56 -08:00
parent 44b8bb8f60
commit f6317fba82
1 changed files with 6 additions and 3 deletions

View File

@ -1444,9 +1444,12 @@ ITEM *NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
{
INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
for( ITEM*item : *l_cur )
if( item->Parent() == aParent )
return item;
if( l_cur )
{
for( ITEM* item : *l_cur )
if( item->Parent() == aParent )
return item;
}
return NULL;
}