Fix crash when adding 3D Models via Python

This commit is contained in:
Jan Mrázek 2020-12-28 17:13:15 +01:00
parent a761d42c12
commit 93466fa165
No known key found for this signature in database
GPG Key ID: A3E71126F180EB6F
2 changed files with 6 additions and 4 deletions

View File

@ -968,13 +968,11 @@ unsigned FOOTPRINT::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
void FOOTPRINT::Add3DModel( FP_3DMODEL* a3DModel )
{
if( NULL == a3DModel )
if( nullptr == a3DModel )
return;
if( !a3DModel->m_Filename.empty() )
m_3D_Drawings.push_back( *a3DModel );
delete a3DModel;
}

View File

@ -3117,7 +3117,11 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
break;
case T_model:
footprint->Add3DModel( parse3DModel() );
{
FP_3DMODEL* model = parse3DModel();
footprint->Add3DModel( model );
delete model;
}
break;
case T_zone: