From 5f620f0fa1a1f3ad44f0d1a26ac3f7aea596d28a Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> Date: Wed, 26 Mar 2025 00:12:17 +0100 Subject: [PATCH] router: don't try to lock the first vertex of a zero-vertex line. Might crash (sometimes). Fixes https://gitlab.com/kicad/code/kicad/issues/20440 --- pcbnew/router/pns_shove.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 4c06bac437..3b3fb36863 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -510,8 +510,8 @@ bool SHOVE::ShoveObstacleLine( const LINE& aCurLine, const LINE& aObstacleLine, if( aObstacleLine.PointCount() >= 2 ) { - jtStart = m_currentNode->FindJoint( aObstacleLine.CPoint(0), &aObstacleLine ); - jtEnd = m_currentNode->FindJoint( aObstacleLine.CPoint(-1), &aObstacleLine ); + jtStart = m_currentNode->FindJoint( aObstacleLine.CPoint( 0 ), &aObstacleLine ); + jtEnd = m_currentNode->FindJoint( aObstacleLine.CPoint( -1 ), &aObstacleLine ); } if( jtStart ) @@ -2495,7 +2495,10 @@ SHOVE::SHOVE_STATUS SHOVE::Run() currentHeadId++; - m_currentNode->LockJoint( head.CPoint( 0 ), &head, true ); + if( head.PointCount() > 0 ) + { + m_currentNode->LockJoint( head.CPoint( 0 ), &head, true ); + } if( !head.EndsWithVia() ) m_currentNode->LockJoint( head.CPoint( -1 ), &head, true );