From fb9b12a9825f4424c1aa3ac8382a302fc9f86a74 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) (cherry picked from commit cee1873ffffef31446230f2bff8683a0e9b9e9ad) Fixes: lp:1850497 * https://bugs.launchpad.net/kicad/+bug/1850497 --- 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 bd23fb0020..21427e1be1 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -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( 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... }