From abb6404ab2d5ba3bb3984443999fd3ff1a6dfda4 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 25 Mar 2023 17:12:13 -0400 Subject: [PATCH] Move up a layer validity check to prevent crash Fixes sentry crash KICAD-RF (cherry picked from commit 604a7d69dba29405d2440fdeebf309b6a6a5a2d6) --- pcbnew/plugins/eagle/eagle_plugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index a5fea03b21..87a6feb5d4 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -2202,7 +2202,9 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con } } - if( p.pour == EPOLYGON::CUTOUT + PCB_LAYER_ID layer = kicad_layer( p.layer ); + + if( ( p.pour == EPOLYGON::CUTOUT && layer != UNDEFINED_LAYER ) || p.layer == EAGLE_LAYER::TRESTRICT || p.layer == EAGLE_LAYER::BRESTRICT || p.layer == EAGLE_LAYER::VRESTRICT ) @@ -2221,8 +2223,6 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con } else { - PCB_LAYER_ID layer = kicad_layer( p.layer ); - if( layer == UNDEFINED_LAYER ) { wxLogMessage( wxString::Format( _( "Ignoring a polygon since Eagle layer '%s' (%d) "