struct ZONE_DESC: ensure ENUM_MAP<PCB_LAYER_ID> is initialized before use it.

ENUM_MAP<PCB_LAYER_ID> is tested initialized in some other XXX_DESC,
but not in ZONE_DESC
Fixes #13699
https://gitlab.com/kicad/code/kicad/issues/13699
This commit is contained in:
jean-pierre charras 2023-02-02 09:11:27 +01:00
parent 26b9d2f5ac
commit 737318a24d
1 changed files with 11 additions and 1 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1356,6 +1356,16 @@ static struct ZONE_DESC
{
ZONE_DESC()
{
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
if( layerEnum.Choices().GetCount() == 0 )
{
layerEnum.Undefined( UNDEFINED_LAYER );
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
layerEnum.Map( *seq, LSET::Name( *seq ) );
}
ENUM_MAP<ZONE_CONNECTION>& zcMap = ENUM_MAP<ZONE_CONNECTION>::Instance();
if( zcMap.Choices().GetCount() == 0 )