Avoid using a nullptr.
This commit is contained in:
parent
66d8f5cae4
commit
90eed8b4b6
|
@ -1891,8 +1891,11 @@ void PNS_KICAD_IFACE_BASE::AddItem( PNS::ITEM* aItem )
|
|||
|
||||
BOARD_CONNECTED_ITEM* PNS_KICAD_IFACE::createBoardItem( PNS::ITEM* aItem )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* newBI = nullptr;
|
||||
auto net = static_cast<NETINFO_ITEM*>( aItem->Net() );
|
||||
BOARD_CONNECTED_ITEM* newBoardItem = nullptr;
|
||||
NETINFO_ITEM* net = static_cast<NETINFO_ITEM*>( aItem->Net() );
|
||||
|
||||
if( !net )
|
||||
net = NETINFO_LIST::OrphanedItem();
|
||||
|
||||
switch( aItem->Kind() )
|
||||
{
|
||||
|
@ -1903,7 +1906,7 @@ BOARD_CONNECTED_ITEM* PNS_KICAD_IFACE::createBoardItem( PNS::ITEM* aItem )
|
|||
new_arc->SetWidth( arc->Width() );
|
||||
new_arc->SetLayer( ToLAYER_ID( arc->Layers().Start() ) );
|
||||
new_arc->SetNet( net );
|
||||
newBI = new_arc;
|
||||
newBoardItem = new_arc;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1917,7 +1920,7 @@ BOARD_CONNECTED_ITEM* PNS_KICAD_IFACE::createBoardItem( PNS::ITEM* aItem )
|
|||
track->SetWidth( seg->Width() );
|
||||
track->SetLayer( ToLAYER_ID( seg->Layers().Start() ) );
|
||||
track->SetNet( net );
|
||||
newBI = track;
|
||||
newBoardItem = track;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1933,7 +1936,7 @@ BOARD_CONNECTED_ITEM* PNS_KICAD_IFACE::createBoardItem( PNS::ITEM* aItem )
|
|||
via_board->SetIsFree( via->IsFree() );
|
||||
via_board->SetLayerPair( ToLAYER_ID( via->Layers().Start() ),
|
||||
ToLAYER_ID( via->Layers().End() ) );
|
||||
newBI = via_board;
|
||||
newBoardItem = via_board;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1952,12 +1955,13 @@ BOARD_CONNECTED_ITEM* PNS_KICAD_IFACE::createBoardItem( PNS::ITEM* aItem )
|
|||
|
||||
if( net->GetNetCode() <= 0 )
|
||||
{
|
||||
NETINFO_ITEM* newNetInfo = newBI->GetNet();
|
||||
NETINFO_ITEM* newNetInfo = newBoardItem->GetNet();
|
||||
|
||||
newNetInfo->SetParent( m_board );
|
||||
newNetInfo->SetNetClass( m_board->GetDesignSettings().m_NetSettings->m_DefaultNetClass );
|
||||
}
|
||||
|
||||
return newBI;
|
||||
return newBoardItem;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue