Footprint editor: fix a crash when trying to edit the properties of a footprint not yet in tree (i.e. imported from file)

(cherry picked from commit cee1873fff)

Fixes: lp:1850497
* https://bugs.launchpad.net/kicad/+bug/1850497
This commit is contained in:
jean-pierre charras 2019-09-06 15:37:26 +02:00 committed by Seth Hillbrand
parent 88a03f1a1d
commit fb9b12a982
1 changed files with 7 additions and 2 deletions

View File

@ -854,8 +854,13 @@ void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
// Update library tree
BASIC_FOOTPRINT_INFO footprintInfo( aModule );
wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
static_cast<LIB_TREE_NODE_LIB_ID*>( treeItem.GetID() )->Update( &footprintInfo );
m_treePane->GetLibTree()->Refresh();
if( treeItem.IsOk() ) // Can be not found in tree if the current footprint is imported from file
// therefore not yet in tree.
{
static_cast<LIB_TREE_NODE_LIB_ID*>( treeItem.GetID() )->Update( &footprintInfo );
m_treePane->GetLibTree()->Refresh();
}
updateTitle(); // in case of a name change...
}