Commit b8cc86bd authored by charras's avatar charras

Fixed: eeschema crashes when creating a new text (comment) in schematic

parent ccfa4e0a
......@@ -226,10 +226,13 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
if( m_MultilineAllowed )
{
list = wxStringSplit( m_Text, '\n' );
if( aLine >= 0 && (aLine < (int)list->GetCount()) )
text = &list->Item( aLine );
else
text = &list->Item( 0 );
if ( list->GetCount() ) // GetCount() == 0 for void strings
{
if( aLine >= 0 && (aLine < (int)list->GetCount()) )
text = &list->Item( aLine );
else
text = &list->Item( 0 );
}
}
......@@ -245,7 +248,7 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
rect.Move(wxPoint(0, -extra_dy/2 ) ); // move origin by the half extra interval
// for multiline texts and aLine < 0, merge all rectangles
if( m_MultilineAllowed && aLine < 0 )
if( m_MultilineAllowed && list && aLine < 0 )
{
for( unsigned ii = 1; ii < list->GetCount(); ii++ )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment