eeschema segfault when a library "T" command is missing Halign Valign values
Fixes: lp:1668082 https://bugs.launchpad.net/kicad/+bug/1668082
This commit is contained in:
parent
f35cb6cd6a
commit
64d6c3f91c
|
@ -2905,42 +2905,46 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr< LIB_PART >& aPart,
|
||||||
if( parseInt( aReader, line, &line ) > 0 )
|
if( parseInt( aReader, line, &line ) > 0 )
|
||||||
text->SetBold( true );
|
text->SetBold( true );
|
||||||
|
|
||||||
switch( parseChar( aReader, line, &line ) )
|
// Some old libaries version > 2.0 do not have these options for text justification:
|
||||||
|
if( !is_eol( *line ) )
|
||||||
{
|
{
|
||||||
case 'L':
|
switch( parseChar( aReader, line, &line ) )
|
||||||
text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
{
|
||||||
break;
|
case 'L':
|
||||||
|
text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
text->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
text->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SCH_PARSE_ERROR( _( "invalid horizontal text justication parameter, expected L, C, or R" ),
|
SCH_PARSE_ERROR( _( "invalid horizontal text justication parameter, expected L, C, or R" ),
|
||||||
aReader, line );
|
aReader, line );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( parseChar( aReader, line, &line ) )
|
switch( parseChar( aReader, line, &line ) )
|
||||||
{
|
{
|
||||||
case 'T':
|
case 'T':
|
||||||
text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SCH_PARSE_ERROR( _( "invalid vertical text justication parameter, expected T, C, or B" ),
|
SCH_PARSE_ERROR( _( "invalid vertical text justication parameter, expected T, C, or B" ),
|
||||||
aReader, line );
|
aReader, line );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue