From a5307c6f5929582dc4ee9e0a8526c9c8e342f1f6 Mon Sep 17 00:00:00 2001 From: Steffen Mauch Date: Mon, 3 Jan 2022 15:55:57 +0100 Subject: [PATCH] pcbnew: fixing eagle_plugin with empty class names Fixes #10229 https://gitlab.com/kicad/code/kicad/issues/10229 --- pcbnew/plugins/eagle/eagle_plugin.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index a7106d69ed..292ab1d05c 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -2484,17 +2484,20 @@ void EAGLE_PLUGIN::loadClasses( wxXmlNode* aClasses ) { for( std::pair entry : eClass.clearanceMap ) { - wxString rule; - rule.Printf( "(rule \"class %s:%s\"\n" - " (condition \"A.NetClass == '%s' && B.NetClass == '%s'\")\n" - " (constraint clearance (min %smm)))\n", - eClass.number, - entry.first, - eClass.name, - m_classMap[ entry.first ]->GetName(), - StringFromValue( EDA_UNITS::MILLIMETRES, entry.second.ToPcbUnits() ) ); + if( m_classMap[ entry.first ] != nullptr ) + { + wxString rule; + rule.Printf( "(rule \"class %s:%s\"\n" + " (condition \"A.NetClass == '%s' && B.NetClass == '%s'\")\n" + " (constraint clearance (min %smm)))\n", + eClass.number, + entry.first, + eClass.name, + m_classMap[ entry.first ]->GetName(), + StringFromValue( EDA_UNITS::MILLIMETRES, entry.second.ToPcbUnits() ) ); - m_customRules += "\n" + rule; + m_customRules += "\n" + rule; + } } }