Fix null-dereference in libedit

Clearing the CurPart sets to null.  Need to keep datasheet checks behind
guards
This commit is contained in:
Seth Hillbrand 2019-09-30 04:52:59 -07:00
parent 31e38f2fd4
commit 7dd9304d24
1 changed files with 6 additions and 2 deletions

View File

@ -381,8 +381,12 @@ void LIB_EDIT_FRAME::SetCurPart( LIB_PART* aPart )
delete m_my_part;
m_my_part = aPart;
// Datasheet field is special; copy it to the root alias docfilename
m_my_part->GetField( DATASHEET )->SetText( aPart->GetRootAlias()->GetDocFileName() );
// Datasheet field is special; copy it to the root alias docfilename but watch out
// for clearing the aPart
if( m_my_part )
{
m_my_part->GetField( DATASHEET )->SetText( aPart->GetRootAlias()->GetDocFileName() );
}
}
// select the current component in the tree widget