Nullptr defensive code.

Fixes https://gitlab.com/kicad/code/kicad/issues/11690
This commit is contained in:
Jeff Young 2022-06-11 22:28:42 +01:00
parent 4f3cfdc92e
commit 9b70308f5c
2 changed files with 22 additions and 15 deletions

View File

@ -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 );

View File

@ -441,6 +441,8 @@ int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
{
footprint = m_frame->LoadFootprint( fpID );
if( footprint )
{
try
{
footprint->SetFPID( LIB_ID( libraryName, newName ) );
@ -461,6 +463,7 @@ int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
// Best efforts...
}
}
}
wxDataViewItem treeItem = m_frame->GetLibTreeAdapter()->FindItem( fpID );
m_frame->UpdateLibraryTree( treeItem, footprint );