diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index a2d4975a6e..e413eecdad 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -181,6 +181,11 @@ public: return m_net; } + bool InAnyNet() const + { + return m_net != UnusedNet; + } + /** * Function SetLayers() * diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 5fca97ad2a..16758036f9 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -780,7 +780,15 @@ void LINE_PLACER::routeStep( const VECTOR2I& aP ) bool LINE_PLACER::route( const VECTOR2I& aP ) { routeStep( aP ); - return CurrentEnd() == aP; + + if (!m_head.PointCount() ) + { + return false; + } + else + { + return m_head.CPoint(-1) == aP; + } } @@ -946,7 +954,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) m_lastNode = NULL; } - route( p ); + bool reachesEnd = route( p ); current = Trace(); @@ -958,7 +966,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) NODE* latestNode = m_currentNode; m_lastNode = latestNode->Branch(); - if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth && current.SegmentCount() ) + if( reachesEnd && eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth && current.SegmentCount() ) { SplitAdjacentSegments( m_lastNode, aEndItem, current.CPoint( -1 ) );