diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 52222713b..bba0b0d63 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -341,11 +341,11 @@ void CTextBox::refreshTextLineArray(void) //TRACE_1(" aktLine : %s\r\n",aktLine.c_str()); //TRACE_1(" aktWidth: %d aktWordWidth:%d\r\n",aktWidth,aktWordWidth); - if( m_cText[pos] == '\n' || + if( ((pos < TextChars) && (m_cText[pos] == '\n')) || loop == false) { // current line ends with an carriage return, make new line - if (m_cText[pos] == '\n') + if ((pos < TextChars) && (m_cText[pos] == '\n')) aktLine.erase(aktLine.size() - 1,1); m_cLineArray.push_back(aktLine); m_nNrOfLines++;