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
This commit is contained in:
jean-pierre charras 2019-04-29 17:21:51 +02:00
parent 434935613c
commit 0ba130dbd3
1 changed files with 5 additions and 2 deletions

View File

@ -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() )
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();