← Back to team overview

kicad-developers team mailing list archive

PATCH: fix crash in netlist updater

 

Hi Seth,

I tried to pull netlist into completely empty board today and got a crash
that I tracked down to
this commit
https://github.com/KiCad/kicad-source-mirror/commit/d1877d7c1b531dee2f4e35304a1d6b33a34c5fff

Simple fix for this particular problem is in attached patch but I didn't go
through all the changes in that commit. It seems in a few places there are
unchecked Modules().front() calls. Maybe they should be changed to
GetFirstModule().

Regards,
Andrew
From b9082b07b4a4dd06d64ad4e872fac9e9e77106be Mon Sep 17 00:00:00 2001
From: qu1ck <anlutsenko@xxxxxxxxx>
Date: Sat, 1 Jun 2019 18:33:33 -0700
Subject: [PATCH] Pcbnew: fix crash in netlist updater

---
 pcbnew/board_netlist_updater.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp
index 1675dd897..a51cfc7d1 100644
--- a/pcbnew/board_netlist_updater.cpp
+++ b/pcbnew/board_netlist_updater.cpp
@@ -689,7 +689,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
     m_errorCount = 0;
     m_warningCount = 0;
     m_newFootprintsCount = 0;
-    MODULE* lastPreexistingFootprint = m_board->Modules().back();
+    MODULE* lastPreexistingFootprint = m_board->Modules().empty() ? NULL : m_board->Modules().back();
 
     cacheCopperZoneConnections();
 
-- 
2.22.0.rc1.257.g3120a18244-goog


Follow ups