Don't dereference NULL when checking current part.

This commit is contained in:
Jeff Young 2018-11-20 20:14:00 +00:00
parent a958b23a11
commit d6ac303a8c
1 changed files with 13 additions and 9 deletions

View File

@ -575,10 +575,13 @@ void LIB_EDIT_FRAME::OnRevert( wxCommandEvent& aEvent )
if( !ConfirmRevertDialog( this, msg ) ) if( !ConfirmRevertDialog( this, msg ) )
return; return;
bool reload_currentPart; bool reload_currentPart = false;
wxString curr_partName = partName; wxString curr_partName = partName;
// the library itself is reverted: the current part will be reloaded only if it is owned by this library if( GetCurPart() )
{
// the library itself is reverted: the current part will be reloaded only if it is
// owned by this library
if( partName.IsEmpty() ) if( partName.IsEmpty() )
{ {
LIB_ID curr_libId = GetCurPart()->GetLibId(); LIB_ID curr_libId = GetCurPart()->GetLibId();
@ -589,6 +592,7 @@ void LIB_EDIT_FRAME::OnRevert( wxCommandEvent& aEvent )
} }
else else
reload_currentPart = isCurrentPart( libId ); reload_currentPart = isCurrentPart( libId );
}
int unit = m_unit; int unit = m_unit;