From 1996fba8a6d90370b8a8da03d82601e4cfa6b6e3 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 19 Jun 2019 00:06:01 +0100 Subject: [PATCH] Check for a tree selection before checking it against the board item. Fixes: lp:1833295 * https://bugs.launchpad.net/kicad/+bug/1833295 --- pcbnew/footprint_editor_utils.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index d5f07106a0..2a2d42b716 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -572,10 +572,14 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_MODEDIT_EXPORT_PART: - if( getTargetFPID() == GetLoadedFPID() ) - Export_Module( GetBoard()->m_Modules ); + { + LIB_ID fpid = m_treePane->GetLibTree()->GetSelectedLibId(); + + if( fpid.IsValid() ) + Export_Module( LoadFootprint( fpid ) ); else - Export_Module( LoadFootprint( getTargetFPID() ) ); + Export_Module( GetBoard()->m_Modules ); + } break; case ID_MODEDIT_CREATE_NEW_LIB: