From cee1873ffffef31446230f2bff8683a0e9b9e9ad Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 6 Sep 2019 15:37:26 +0200 Subject: [PATCH] Footprint editor: fix a crash when trying to edit the properties of a footprint not yet in tree (i.e. imported from file) --- pcbnew/footprint_editor_utils.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index ca64d4a57d..6c27e914b7 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -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( 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( treeItem.GetID() )->Update( &footprintInfo ); + m_treePane->GetLibTree()->Refresh(); + } updateTitle(); // in case of a name change...