Eagle plugin: check before dereferencing optional attributes

This commit is contained in:
Maciej Suminski 2017-06-19 14:44:31 +02:00
parent 7ea33f76b4
commit 7d2320b5ad
1 changed files with 21 additions and 18 deletions

View File

@ -552,8 +552,8 @@ SCH_GLOBALLABEL* SCH_EAGLE_PLUGIN::loadLabel(wxXmlNode* aLabelNode, wxString aNe
glabel->SetText(elabel.netname);
glabel->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
EROT rot = elabel.rot.Get();
glabel->SetLabelSpinStyle( int(rot.degrees/90+2)%4 );
if( elabel.rot )
glabel->SetLabelSpinStyle( int( elabel.rot.Get().degrees/90+2)%4 );
return glabel.release();
}
@ -783,6 +783,8 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( LIB_PART* aPart, wxXmlNode* aPin )
break;
}
if( epin.length )
{
wxString length = epin.length.Get();
if( length =="short" )
@ -801,6 +803,7 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( LIB_PART* aPart, wxXmlNode* aPin )
{
pin->SetLength( 0 );
}
}
return pin.release();
}