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

This commit is contained in:
jean-pierre charras 2019-09-06 15:37:26 +02:00
parent e0c82fb003
commit cee1873fff
1 changed files with 7 additions and 2 deletions

View File

@ -350,8 +350,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...