From 54c68080f543247d47aef60c894c19b34e7af2fe Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 11 Jun 2022 22:28:42 +0100 Subject: [PATCH] Nullptr defensive code. Fixes https://gitlab.com/kicad/code/kicad/issues/11690 (cherry picked from commit 9b70308f5c4393a33c0048dc0e1c4da6e96ae3a4) --- pcbnew/footprint_viewer_frame.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index e5abffaa47..2ca4962c87 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -247,7 +247,11 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent id.SetLibNickname( getCurNickname() ); id.SetLibItemName( getCurFootprintName() ); - GetBoard()->Add( loadFootprint( id ) ); + + FOOTPRINT* footprint = loadFootprint( id ); + + if( footprint ) + GetBoard()->Add( footprint ); } drawPanel->DisplayBoard( m_pcb );