Don't assume a valid constraint.

Fixes https://gitlab.com/kicad/code/kicad/issues/6059
This commit is contained in:
Jeff Young 2020-10-18 20:58:03 +01:00
parent dd53b9c399
commit d7ea70ba02
1 changed files with 12 additions and 6 deletions

View File

@ -290,16 +290,22 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
if( IsDiffPair( aA, aB ) ) if( IsDiffPair( aA, aB ) )
{ {
// for diff pairs, we use the gap value for shoving/dragging // for diff pairs, we use the gap value for shoving/dragging
ok = QueryConstraint( PNS::CONSTRAINT_TYPE::CT_DIFF_PAIR_GAP, aA, aB, aA->Layer(), if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_DIFF_PAIR_GAP, aA, aB, aA->Layer(),
&constraint ); &constraint ) )
{
rv = constraint.m_Value.Opt(); rv = constraint.m_Value.Opt();
ok = true;
}
} }
if( !ok ) if( !ok )
{ {
ok = QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, aA->Layer(), if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, aA->Layer(),
&constraint ); &constraint ) )
{
rv = constraint.m_Value.Min(); rv = constraint.m_Value.Min();
ok = true;
}
} }
// still no valid clearance rule? fall back to global minimum. // still no valid clearance rule? fall back to global minimum.