Nullptr defensive code.
Fixes https://gitlab.com/kicad/code/kicad/issues/11690
This commit is contained in:
parent
4f3cfdc92e
commit
9b70308f5c
|
@ -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 );
|
||||
|
|
|
@ -441,24 +441,27 @@ int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
footprint = m_frame->LoadFootprint( fpID );
|
||||
|
||||
try
|
||||
if( footprint )
|
||||
{
|
||||
footprint->SetFPID( LIB_ID( libraryName, newName ) );
|
||||
try
|
||||
{
|
||||
footprint->SetFPID( LIB_ID( libraryName, newName ) );
|
||||
|
||||
if( footprint->GetValue() == oldName )
|
||||
footprint->SetValue( newName );
|
||||
if( footprint->GetValue() == oldName )
|
||||
footprint->SetValue( newName );
|
||||
|
||||
m_frame->SaveFootprintInLibrary( footprint, libraryName );
|
||||
m_frame->SaveFootprintInLibrary( footprint, libraryName );
|
||||
|
||||
m_frame->Prj().PcbFootprintLibs()->FootprintDelete( libraryName, oldName );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( m_frame, ioe.What() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Best efforts...
|
||||
m_frame->Prj().PcbFootprintLibs()->FootprintDelete( libraryName, oldName );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( m_frame, ioe.What() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Best efforts...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue