Eeschema: fix misplaced nullptr test that prevent saving SCH_TEXT items.
Fixes #11250 https://gitlab.com/kicad/code/kicad/issues/11250
This commit is contained in:
parent
38bd612c01
commit
cfe0003ca4
|
@ -1057,10 +1057,9 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aText != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aText != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
|
// Note: label is nullptr SCH_TEXT, but not for SCH_LABEL_XXX,
|
||||||
SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( aText );
|
SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( aText );
|
||||||
|
|
||||||
wxCHECK( label, /* void */ );
|
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(%s %s",
|
m_out->Print( aNestLevel, "(%s %s",
|
||||||
getTextTypeToken( aText->Type() ),
|
getTextTypeToken( aText->Type() ),
|
||||||
m_out->Quotew( aText->GetText() ).c_str() );
|
m_out->Quotew( aText->GetText() ).c_str() );
|
||||||
|
@ -1079,7 +1078,8 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
||||||
|| aText->Type() == SCH_HIER_LABEL_T
|
|| aText->Type() == SCH_HIER_LABEL_T
|
||||||
|| aText->Type() == SCH_DIRECTIVE_LABEL_T )
|
|| aText->Type() == SCH_DIRECTIVE_LABEL_T )
|
||||||
{
|
{
|
||||||
m_out->Print( 0, " (shape %s)", getSheetPinShapeToken( label->GetShape() ) );
|
if( label ) // Should be always the case
|
||||||
|
m_out->Print( 0, " (shape %s)", getSheetPinShapeToken( label->GetShape() ) );
|
||||||
|
|
||||||
// The angle of the text is always 0 or 90 degrees for readibility reasons,
|
// The angle of the text is always 0 or 90 degrees for readibility reasons,
|
||||||
// but the item itself can have more rotation (-90 and 180 deg)
|
// but the item itself can have more rotation (-90 and 180 deg)
|
||||||
|
|
Loading…
Reference in New Issue