Fix crash when converting a Eagle board to a Kicad board.
During conversion a illegal layer number was used without filtering
This commit is contained in:
parent
7d1a4a4224
commit
a431fd99ca
|
@ -785,7 +785,10 @@ public:
|
||||||
*/
|
*/
|
||||||
inline bool IsLayerEnabled( PCB_LAYER_ID aLayerId ) const
|
inline bool IsLayerEnabled( PCB_LAYER_ID aLayerId ) const
|
||||||
{
|
{
|
||||||
|
if( aLayerId >= 0 && aLayerId < PCB_LAYER_ID_COUNT )
|
||||||
return m_enabledLayers[aLayerId];
|
return m_enabledLayers[aLayerId];
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -530,12 +530,7 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// some eagle boards do not have contiguous layer number sequences.
|
// some eagle boards do not have contiguous layer number sequences.
|
||||||
|
|
||||||
#if 0 // pre PCB_LAYER_ID & LSET:
|
|
||||||
m_cu_map[it->number] = cu.size() - 1 - ki_layer_count;
|
|
||||||
#else
|
|
||||||
m_cu_map[it->number] = ki_layer_count;
|
m_cu_map[it->number] = ki_layer_count;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,10 +543,12 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
||||||
{
|
{
|
||||||
PCB_LAYER_ID layer = kicad_layer( it->number );
|
PCB_LAYER_ID layer = kicad_layer( it->number );
|
||||||
|
|
||||||
// these function provide their own protection against UNDEFINED_LAYER:
|
// these function provide their own protection against non enabled layers:
|
||||||
|
if( layer >= 0 && layer < PCB_LAYER_ID_COUNT ) // layer should be valid
|
||||||
|
{
|
||||||
m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) );
|
m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) );
|
||||||
m_board->SetLayerType( layer, LT_SIGNAL );
|
m_board->SetLayerType( layer, LT_SIGNAL );
|
||||||
|
}
|
||||||
// could map the colors here
|
// could map the colors here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue