Force grids to have entries.

If they don't in the file, reset to the default

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21060
This commit is contained in:
Seth Hillbrand 2025-06-09 13:12:10 -07:00
parent 307f3c17bc
commit e957d10098

View File

@ -455,6 +455,10 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std:
m_params.emplace_back( new PARAM_LIST<GRID>( aJsonPath + ".grid.sizes", &aWindow->grid.grids, m_params.emplace_back( new PARAM_LIST<GRID>( aJsonPath + ".grid.sizes", &aWindow->grid.grids,
DefaultGridSizeList() ) ); DefaultGridSizeList() ) );
// Force grids to have at least 1 entry. If not, reset to default.
if( aWindow->grid.grids.empty() )
aWindow->grid.grids = DefaultGridSizeList();
m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size", m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size",
&aWindow->grid.last_size_idx, defaultGridIdx ) ); &aWindow->grid.last_size_idx, defaultGridIdx ) );