Ensure currentGrid is valid on startup

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4666
This commit is contained in:
Jon Evans 2020-06-16 19:59:00 -04:00
parent 8c57821e9b
commit 0dd34d197e
1 changed files with 2 additions and 0 deletions

View File

@ -392,6 +392,8 @@ int COMMON_TOOLS::OnGridChanged()
{
int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
currentGrid = std::max( 0, std::min( currentGrid, static_cast<int>( m_grids.size() ) - 1 ) );
// Update the combobox (if any)
wxUpdateUIEvent dummy;
m_frame->OnUpdateSelectGrid( dummy );