Browse Source

We need to clamp the index to max - 1

What did we think this was?  Pascal?

Fixes https://gitlab.com/kicad/code/kicad/issues/21750
master
Seth Hillbrand 3 weeks ago
parent
commit
9c0727f28e
  1. 4
      pcbnew/board_design_settings.cpp

4
pcbnew/board_design_settings.cpp

@ -1347,7 +1347,7 @@ int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue() const
void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( int aIndex ) void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( int aIndex )
{ {
m_viaSizeIndex = std::min( aIndex, (int) m_ViasDimensionsList.size() );
m_viaSizeIndex = std::min( aIndex, (int) m_ViasDimensionsList.size() - 1 );
m_useCustomTrackVia = false; m_useCustomTrackVia = false;
} }
@ -1380,7 +1380,7 @@ int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill() const
void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( int aIndex ) void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( int aIndex )
{ {
m_trackWidthIndex = std::min( aIndex, (int) m_TrackWidthList.size() );
m_trackWidthIndex = std::min( aIndex, (int) m_TrackWidthList.size() - 1 );
m_useCustomTrackVia = false; m_useCustomTrackVia = false;
} }

Loading…
Cancel
Save