PNS: Collision search context may be null

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14741


(cherry picked from commit 94130716a5)
This commit is contained in:
Jon Evans 2023-05-14 17:20:59 -04:00
parent 91f40ac779
commit f02cd717bc
2 changed files with 16 additions and 5 deletions

View File

@ -139,7 +139,8 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
} }
else else
{ {
clearance = aNode->GetClearance( this, aHead, aCtx->options.m_useClearanceEpsilon ); clearance = aNode->GetClearance( this, aHead,
aCtx ? aCtx->options.m_useClearanceEpsilon : false );
} }
if( clearance >= 0 ) if( clearance >= 0 )

View File

@ -598,6 +598,8 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio
aViaOk = buildInitialLine( walkP, l1, round == 0 ); aViaOk = buildInitialLine( walkP, l1, round == 0 );
PNS_DBG( Dbg(), AddItem, &l1, BLUE, 20000, wxT( "walk-base-l1" ) ); PNS_DBG( Dbg(), AddItem, &l1, BLUE, 20000, wxT( "walk-base-l1" ) );
if( l1.EndsWithVia() )
PNS_DBG( Dbg(), AddPoint, l1.Via().Pos(), BLUE, 100000, wxT( "walk-base-l1-via" ) ); PNS_DBG( Dbg(), AddPoint, l1.Via().Pos(), BLUE, 100000, wxT( "walk-base-l1-via" ) );
LINE initTrack( m_tail ); LINE initTrack( m_tail );
@ -731,7 +733,12 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio
} }
PNS_DBG( Dbg(), AddItem, &walkFull, GREEN, 200000, wxT( "walk-full" ) ); PNS_DBG( Dbg(), AddItem, &walkFull, GREEN, 200000, wxT( "walk-full" ) );
PNS_DBG( Dbg(), AddPoint, walkFull.Via().Pos(), GREEN, 200000, wxString::Format( "walk-via ok %d", aViaOk?1:0 ) );
if( walkFull.EndsWithVia() )
{
PNS_DBG( Dbg(), AddPoint, walkFull.Via().Pos(), GREEN, 200000,
wxString::Format( "walk-via ok %d", aViaOk ? 1 : 0 ) );
}
aWalkLine = walkFull; aWalkLine = walkFull;
@ -987,8 +994,11 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTai
OPTIMIZER optimizer( m_currentNode ); OPTIMIZER optimizer( m_currentNode );
if( newHead.EndsWithVia() )
{
PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-via-preopt" ); PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-via-preopt" );
PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-via-postopt" ); PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-via-postopt" );
}
if( ! splitHeadTail( newHead, m_tail, aNewHead, aNewTail ) ) if( ! splitHeadTail( newHead, m_tail, aNewHead, aNewTail ) )
return false; return false;