From fe1579ebbdacb4955b216b2269a4f5e04a2ee20f Mon Sep 17 00:00:00 2001 From: jean-pierre charras <jp.charras@wanadoo.fr> Date: Sun, 11 Feb 2024 21:03:00 +0100 Subject: [PATCH] BOARD_NETLIST_UPDATER: fix issue when reading net-lists having no FOOTPRINT_FIELD they can be old net-lists or non Kicad net-lists. Fixes #16931 https://gitlab.com/kicad/code/kicad/-/issues/16931 --- pcbnew/netlist_reader/board_netlist_updater.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index 18d27b356a..a52fcc9246 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -320,8 +320,16 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint, if( ( m_replaceFootprints || ( aPcbFootprint->GetAttributes() & FP_JUST_ADDED ) ) && !m_isDryRun ) { - aPcbFootprint->Footprint().SetText( + // Update FOOTPRINT_FIELD (if exists in the netlist) + try + { + aPcbFootprint->Footprint().SetText( aNetlistComponent->GetFields()[GetCanonicalFieldName( FOOTPRINT_FIELD )] ); + } + catch( ... ) + { + // If not exist (old netlist), just skip it: What else? + } } // Test for time stamp change.