From 1b6b2d78962a5de77df427dadbfd137f9d8fff8c Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Wed, 3 Jan 2024 10:16:08 -0500 Subject: [PATCH] Fix crash when importing Eagle board file with no "classes" element. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16504 --- pcbnew/plugins/eagle/eagle_plugin.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 699656e78c..0293e5f083 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2024 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 @@ -2511,6 +2511,10 @@ void EAGLE_PLUGIN::deleteTemplates() void EAGLE_PLUGIN::loadClasses( wxXmlNode* aClasses ) { + // Eagle board DTD defines the "classes" element as 0 or 1. + if( !aClasses ) + return; + BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); m_xpath->push( "classes.class", "number" ); @@ -2575,6 +2579,10 @@ void EAGLE_PLUGIN::loadClasses( wxXmlNode* aClasses ) void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals ) { + // Eagle board DTD defines the "signals" element as 0 or 1. + if( !aSignals ) + return; + ZONES zones; // per net int netCode = 1;