From 07e1278c05b6e20827e7ce379f4ed9eaf87b01ba Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 4 Feb 2022 16:34:28 +0100 Subject: [PATCH] fix incorrect calculation EDA_TEXT::GetTextBox() for empty texts. It generates KiROUND alert. --- common/eda_text.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 1336736c36..ba6c2953b5 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -529,7 +529,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const { 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( strings.GetCount() ) ) ) text = strings.Item( aLine ); @@ -559,7 +559,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const rect.SetOrigin( pos ); // 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++ ) {