Commit b8cc86bd authored by charras's avatar charras
Browse files

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

parent ccfa4e0a
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -226,11 +226,14 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
    if( m_MultilineAllowed )
    {
        list = wxStringSplit( m_Text, '\n' );
        if ( list->GetCount() )     // GetCount() == 0 for void strings
        {
            if( aLine >= 0 && (aLine < (int)list->GetCount()) )
                text = &list->Item( aLine );
            else
                text = &list->Item( 0 );
        }
    }


    // calculate the H and V size
@@ -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++ )
        {