From 0ba130dbd3866ad14427876d5cecd1255e2863db Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 29 Apr 2019 17:21:51 +0200 Subject: [PATCH] Pcbnew: fix in board editor crash when try to load a footprint from Add footprint tool if the latest loaded footprint was deleted. In this case, the history has a cleared link that created the crash when the dialog tried to select this deleted FootprintEnumerate Fixes: lp:1826794 https://bugs.launchpad.net/kicad/+bug/1826794 --- pcbnew/load_select_footprint.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 3bea13c24a..a33fb1f229 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -233,8 +233,11 @@ MODULE* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect, bool aAll if( aPreselect.IsValid() ) adapter->SetPreselectNode( aPreselect, 0 ); - else if( !historyInfos.empty() ) - adapter->SetPreselectNode( historyInfos[0]->GetLibId(), 0 ); + else if( historyInfos.size() ) + { + if( historyInfos[0] ) // Can be null if the footprint was deleted since the last call + adapter->SetPreselectNode( historyInfos[0]->GetLibId(), 0 ); + } adapter->AddLibraries();