Gracefully handle lack of diff pair settings

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7806
This commit is contained in:
Jon Evans 2021-03-05 09:09:24 -05:00
parent 0596318d93
commit 68f958145d
2 changed files with 13 additions and 7 deletions

View File

@ -304,12 +304,12 @@ public:
/**
* @return the biggest clearance value found in NetClasses list.
*/
int GetBiggestClearanceValue();
int GetBiggestClearanceValue() const;
/**
* @return the smallest clearance value found in NetClasses list.
*/
int GetSmallestClearanceValue();
int GetSmallestClearanceValue() const;
/**
* @return the current micro via size that is the current netclass value.
@ -547,8 +547,10 @@ public:
{
if( m_useCustomDiffPair )
return m_customDiffPair.m_Width;
else
else if( m_diffPairIndex < m_DiffPairDimensionsList.size() )
return m_DiffPairDimensionsList[m_diffPairIndex].m_Width;
else
return GetCurrentTrackWidth();
}
/**
@ -560,8 +562,10 @@ public:
{
if( m_useCustomDiffPair )
return m_customDiffPair.m_Gap;
else
else if( m_diffPairIndex < m_DiffPairDimensionsList.size() )
return m_DiffPairDimensionsList[m_diffPairIndex].m_Gap;
else
return GetSmallestClearanceValue();
}
/**
@ -573,8 +577,10 @@ public:
{
if( m_useCustomDiffPair )
return m_customDiffPair.m_ViaGap;
else
else if( m_diffPairIndex < m_DiffPairDimensionsList.size() )
return m_DiffPairDimensionsList[m_diffPairIndex].m_ViaGap;
else
return GetSmallestClearanceValue();
}
/**

View File

@ -868,7 +868,7 @@ bool BOARD_DESIGN_SETTINGS::Ignore( int aDRCErrorCode )
}
int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue()
int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue() const
{
int biggest = 0;
DRC_CONSTRAINT constraint;
@ -889,7 +889,7 @@ int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue()
}
int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue()
int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue() const
{
int clearance = GetDefault()->GetClearance();