fix incorrect calculation EDA_TEXT::GetTextBox() for empty texts.

It generates KiROUND alert.
This commit is contained in:
jean-pierre charras 2022-02-04 16:34:28 +01:00
parent 57df1b469a
commit 07e1278c05
1 changed files with 2 additions and 2 deletions

View File

@ -529,7 +529,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
{ {
wxStringSplit( text, strings, '\n' ); wxStringSplit( text, strings, '\n' );
if( strings.GetCount() ) // GetCount() == 0 for void strings if( strings.GetCount() ) // GetCount() == 0 for void strings with multilines allowed
{ {
if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) ) if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
text = strings.Item( aLine ); text = strings.Item( aLine );
@ -559,7 +559,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
rect.SetOrigin( pos ); rect.SetOrigin( pos );
// for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines) // for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
if( IsMultilineAllowed() && aLine < 0 ) if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
{ {
for( unsigned ii = 1; ii < strings.GetCount(); ii++ ) for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{ {