Commit 630a3fb1 authored by Maciej Suminski's avatar Maciej Suminski

Safer RN_NET::GetNodes()

parent 7f3bf1be
...@@ -548,15 +548,17 @@ const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode ) const ...@@ -548,15 +548,17 @@ const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode ) const
for( it = nodes.begin(), itEnd = nodes.end(); it != itEnd; ++it ) for( it = nodes.begin(), itEnd = nodes.end(); it != itEnd; ++it )
{ {
RN_NODE_PTR node = *it;
// Obviously the distance between node and itself is the shortest, // Obviously the distance between node and itself is the shortest,
// that's why we have to skip it // that's why we have to skip it
if( *it != aNode ) if( node != aNode )
{ {
unsigned int distance = getDistance( *it, aNode ); unsigned int distance = getDistance( node, aNode );
if( distance < minDistance ) if( distance < minDistance )
{ {
minDistance = distance; minDistance = distance;
closest = *it; closest = node;
} }
} }
} }
...@@ -650,6 +652,8 @@ std::list<RN_NODE_PTR> RN_NET::GetNodes( const BOARD_CONNECTED_ITEM* aItem ) con ...@@ -650,6 +652,8 @@ std::list<RN_NODE_PTR> RN_NET::GetNodes( const BOARD_CONNECTED_ITEM* aItem ) con
{ {
std::list<RN_NODE_PTR> nodes; std::list<RN_NODE_PTR> nodes;
try
{
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_PAD_T: case PCB_PAD_T:
...@@ -679,6 +683,11 @@ std::list<RN_NODE_PTR> RN_NET::GetNodes( const BOARD_CONNECTED_ITEM* aItem ) con ...@@ -679,6 +683,11 @@ std::list<RN_NODE_PTR> RN_NET::GetNodes( const BOARD_CONNECTED_ITEM* aItem ) con
default: default:
break; break;
} }
}
catch ( ... )
{
return nodes;
}
return nodes; return nodes;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment