7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-04 23:35:31 +00:00

PNS: Use HasHole to check if an item has a hole

Just checking Hole() for nullptr isn't valid

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19948
This commit is contained in:
Jon Evans 2025-02-13 21:53:49 -05:00
parent 9e4204340f
commit 1c85751bf0
2 changed files with 4 additions and 4 deletions

View File

@ -150,12 +150,12 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode, int aLayer,
}
// And a special case for the "head" via's hole.
if( holeH && shouldWeConsiderHoleCollisions( this, holeH ) )
if( aHead->HasHole() && shouldWeConsiderHoleCollisions( this, holeH ) )
{
if( Net() != holeH->Net() && collideSimple( holeH, aNode, aLayer, aCtx ) )
collisionsFound = true;
}
if( holeI && shouldWeConsiderHoleCollisions( holeI, aHead ) )
if( HasHole() && shouldWeConsiderHoleCollisions( holeI, aHead ) )
{
collisionsFound |= holeI->collideSimple( aHead, aNode, aLayer, aCtx );
}

View File

@ -69,7 +69,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, PNS::ROUTER_IF
// TODO(JE) padstacks -- need to know the layer here
m_shape = aItem->Shape( -1 )->Clone();
if( aItem->Hole() )
if( aItem->HasHole() )
m_hole = aItem->Hole()->Shape( -1 )->Clone();
}
@ -187,7 +187,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::ITEM* aItem )
delete m_hole;
m_hole = nullptr;
if( aItem->Hole() )
if( aItem->HasHole() )
m_hole = aItem->Hole()->Shape( -1 )->Clone();
break;