diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 6afdf0ab7c..6350397300 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -540,13 +540,16 @@ bool ROUTER::Finish() if( !getNearestRatnestAnchor( otherEnd, otherEndLayers ) ) return false; - // Keep moving until we don't change position + // Keep moving until we don't change position or hit the limit + int triesLeft = 5; VECTOR2I moveResultPoint; + do { moveResultPoint = Placer()->CurrentEnd(); Move( otherEnd, ¤t ); - } while( Placer()->CurrentEnd() != moveResultPoint ); + triesLeft--; + } while( Placer()->CurrentEnd() != moveResultPoint && triesLeft ); // If we've made it, fix the route and we're done if( moveResultPoint == otherEnd && otherEndLayers.Overlaps( GetCurrentLayer() ) ) @@ -794,7 +797,7 @@ std::unique_ptr ROUTER::GetUpdatedItems( std::vector& aRemoved } tmpNode->GetUpdatedItems( aRemoved, aAdded ); - + return std::move( tmpNode ); }