diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 0d29750595..d52d6d7ff6 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1214,9 +1214,11 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1. // zero is reserved for "no connection" and is not used. // NULL is returned for non valid netcodes - NETINFO_ITEM* net = m_NetInfo.GetNetItem( aNetcode ); - return net; + if( aNetcode == NETINFO_LIST::UNCONNECTED ) + return &NETINFO_LIST::ORPHANED; + else + return m_NetInfo.GetNetItem( aNetcode ); } diff --git a/pcbnew/class_board_connected_item.cpp b/pcbnew/class_board_connected_item.cpp index d7c54e7925..dea966b844 100644 --- a/pcbnew/class_board_connected_item.cpp +++ b/pcbnew/class_board_connected_item.cpp @@ -53,19 +53,11 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode ) { BOARD* board = GetBoard(); - if( board ) - { - m_netinfo = board->FindNet( aNetCode ); - // The requested net does not exist, mark it as unconnected - if( m_netinfo == NULL ) - m_netinfo = board->FindNet( NETINFO_LIST::UNCONNECTED ); - } + if( board ) + m_netinfo = board->FindNet( aNetCode ); else - { - // There is no board that contains list of nets, the item is orphaned m_netinfo = &NETINFO_LIST::ORPHANED; - } }