Protect against uninitialised netcodes when adding to RN_DATA

This commit is contained in:
John Beard 2016-09-23 22:16:31 +08:00 committed by Maciej Suminski
parent 47772e7ae3
commit 6b7c2685b2
1 changed files with 7 additions and 1 deletions

View File

@ -1069,7 +1069,7 @@ void RN_NET::processPads()
bool RN_DATA::Add( const BOARD_ITEM* aItem ) bool RN_DATA::Add( const BOARD_ITEM* aItem )
{ {
int net; int net = NETINFO_LIST::ORPHANED;
if( aItem->IsConnected() ) if( aItem->IsConnected() )
{ {
@ -1112,6 +1112,12 @@ bool RN_DATA::Add( const BOARD_ITEM* aItem )
return true; return true;
} }
if( net == NETINFO_LIST::ORPHANED )
return false;
// If the netcode is set, it should be valid for indexing into vector
assert( net < (int) m_nets.size() );
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_PAD_T: case PCB_PAD_T: