Gerbview: fix crash in LAYERS_MAP_DIALOG when trying to use a stored choice,
if no choice exists (new install for instance) Fixes #4862 https://gitlab.com/kicad/code/kicad/issues/4862
This commit is contained in:
parent
4486b0b6d6
commit
a1a8eca844
|
@ -307,7 +307,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
|
||||||
|
|
||||||
void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
auto config = static_cast<GERBVIEW_SETTINGS*>( Kiface().KifaceSettings() );
|
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||||
|
|
||||||
m_exportBoardCopperLayersCount = config->m_BoardLayersCount;
|
m_exportBoardCopperLayersCount = config->m_BoardLayersCount;
|
||||||
normalizeBrdLayersCount();
|
normalizeBrdLayersCount();
|
||||||
|
@ -317,6 +317,10 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
||||||
|
|
||||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||||
{
|
{
|
||||||
|
// Ensure the layer mapping in config exists for this layer, and store it
|
||||||
|
if( (size_t)ii >= config->m_GerberToPcbLayerMapping.size() )
|
||||||
|
break;
|
||||||
|
|
||||||
m_layersLookUpTable[ii] = config->m_GerberToPcbLayerMapping[ ii ];
|
m_layersLookUpTable[ii] = config->m_GerberToPcbLayerMapping[ ii ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue