Made two functions immune to empty containers.

This commit is contained in:
Maciej Suminski 2014-01-10 17:19:33 +01:00
parent 487b609e76
commit 386d1fc257
2 changed files with 5 additions and 2 deletions

View File

@ -70,7 +70,10 @@ public:
void MIN_SPAN_TREE_PADS::AddTreeToRatsnest( std::vector<RATSNEST_ITEM> &aRatsnestList )
{
std::vector<D_PAD*> & padsBuffer = *m_PadsList;
std::vector<D_PAD*>& padsBuffer = *m_PadsList;
if( padsBuffer.empty() )
return;
int netcode = padsBuffer[0]->GetNet();
// Note: to get edges in minimum spanning tree,
// the index value 0 is not used: it is just

View File

@ -240,7 +240,7 @@ void RN_NET::compute()
return;
}
else if( boardNodes.size() == 1 ) // This case is even simpler
else if( boardNodes.size() == 1 || boardNodes.empty() ) // This case is even simpler
{
m_rnEdges.reset( new std::vector<RN_EDGE_PTR>( 0 ) );