PNS: Add defensive coding to AlternateShape()
Adds additional check/warnings about missing alternate shapes when they are expected. Fixes https://gitlab.com/kicad/code/kicad/issues/5233
This commit is contained in:
parent
87b078927c
commit
dd9f7c8c25
|
@ -34,11 +34,22 @@ void INDEX::Add( ITEM* aItem )
|
||||||
|
|
||||||
for( int i = range.Start(); i <= range.End(); ++i )
|
for( int i = range.Start(); i <= range.End(); ++i )
|
||||||
{
|
{
|
||||||
if( ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aItem, i )
|
if( !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aItem, i ) )
|
||||||
&& aItem->AlternateShape() )
|
{
|
||||||
m_subIndices[i].Add( aItem, aItem->AlternateShape()->BBox() );
|
if( aItem->AlternateShape() )
|
||||||
|
m_subIndices[i].Add( aItem, aItem->AlternateShape()->BBox() );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( "Missing expected Alternate shape for %s at %d %d",
|
||||||
|
aItem->Parent()->GetClass(), aItem->Anchor( 0 ).x, aItem->Anchor( 0 ).y );
|
||||||
|
m_subIndices[i].Add( aItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_subIndices[i].Add( aItem );
|
m_subIndices[i].Add( aItem );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_allItems.insert( aItem );
|
m_allItems.insert( aItem );
|
||||||
|
|
|
@ -45,13 +45,23 @@ bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VEC
|
||||||
if( !aOther->Layers().IsMultilayer()
|
if( !aOther->Layers().IsMultilayer()
|
||||||
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aOther->Layer() ) )
|
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aOther->Layer() ) )
|
||||||
{
|
{
|
||||||
shapeA = AlternateShape();
|
if( !AlternateShape() )
|
||||||
|
wxLogError
|
||||||
|
( "Missing expected Alternate shape for %s at %d %d", m_parent->GetClass(),
|
||||||
|
Anchor( 0 ).x, Anchor( 0 ).y );
|
||||||
|
else
|
||||||
|
shapeA = AlternateShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Layers().IsMultilayer()
|
if( !Layers().IsMultilayer()
|
||||||
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aOther, Layer() ) )
|
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aOther, Layer() ) )
|
||||||
{
|
{
|
||||||
shapeB = aOther->AlternateShape();
|
if( !aOther->AlternateShape() )
|
||||||
|
wxLogError
|
||||||
|
( "Missing expected Alternate shape for %s at %d %d", aOther->Parent()->GetClass(),
|
||||||
|
aOther->Anchor( 0 ).x, aOther->Anchor( 0 ).y );
|
||||||
|
else
|
||||||
|
shapeB = aOther->AlternateShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aNeedMTV )
|
if( aNeedMTV )
|
||||||
|
|
Loading…
Reference in New Issue