From 33a40e788be09d34753adf4acee40d325764573c Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Mon, 13 Jan 2020 14:38:55 +0000 Subject: [PATCH] Add missing null check to library viewer control tool --- eeschema/tools/lib_control.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eeschema/tools/lib_control.cpp b/eeschema/tools/lib_control.cpp index 68287467a0..4c1c4ad602 100644 --- a/eeschema/tools/lib_control.cpp +++ b/eeschema/tools/lib_control.cpp @@ -372,10 +372,12 @@ int LIB_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) } else { - part = viewFrame->GetSelectedSymbol(); - libId = part->GetLibId(); - unit = viewFrame->GetUnit(); + part = viewFrame->GetSelectedSymbol(); + unit = viewFrame->GetUnit(); convert = viewFrame->GetConvert(); + + if( part ) + libId = part->GetLibId(); } } @@ -389,7 +391,7 @@ int LIB_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) return 0; } - SCH_COMPONENT* comp = new SCH_COMPONENT( *part, libId,g_CurrentSheet, unit, convert ); + SCH_COMPONENT* comp = new SCH_COMPONENT( *part, libId, g_CurrentSheet, unit, convert ); // Be sure the link to the corresponding LIB_PART is OK: comp->Resolve( *m_frame->Prj().SchSymbolLibTable() );