From 93d42e990215d5ae91fe47db9a4de2fbdcaea0da Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 25 Apr 2021 15:13:42 +0200 Subject: [PATCH] Pcbnew: Fix crash when importing a netlist created by a 5.1 Eeschema version. Fixes #8293 https://gitlab.com/kicad/code/kicad/issues/8293 --- pcbnew/netlist_reader/board_netlist_updater.cpp | 4 +++- pcbnew/netlist_reader/pcb_netlist.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index d4a9cf541c..9a7e65c1ac 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -305,7 +305,9 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint, // Test for time stamp change. KIID_PATH new_path = aNetlistComponent->GetPath(); - new_path.push_back( aNetlistComponent->GetKIIDs().front() ); + + if( !aNetlistComponent->GetKIIDs().empty() ) + new_path.push_back( aNetlistComponent->GetKIIDs().front() ); if( aPcbFootprint->GetPath() != new_path ) { diff --git a/pcbnew/netlist_reader/pcb_netlist.cpp b/pcbnew/netlist_reader/pcb_netlist.cpp index 88b421d68b..f522a32462 100644 --- a/pcbnew/netlist_reader/pcb_netlist.cpp +++ b/pcbnew/netlist_reader/pcb_netlist.cpp @@ -42,7 +42,8 @@ void COMPONENT::SetFootprint( FOOTPRINT* aFootprint ) m_footprint.reset( aFootprint ); KIID_PATH path = m_path; - path.push_back( m_kiids.front() ); + if( !m_kiids.empty() ) + path.push_back( m_kiids.front() ); if( aFootprint == NULL ) return;