gui/widget/textbox.cpp: fix string access outside of its size

This commit is contained in:
[CST] Focus
2012-05-10 11:39:54 +04:00
parent bb720492a5
commit b014b965f4

View File

@@ -341,11 +341,11 @@ void CTextBox::refreshTextLineArray(void)
//TRACE_1(" aktLine : %s\r\n",aktLine.c_str()); //TRACE_1(" aktLine : %s\r\n",aktLine.c_str());
//TRACE_1(" aktWidth: %d aktWordWidth:%d\r\n",aktWidth,aktWordWidth); //TRACE_1(" aktWidth: %d aktWordWidth:%d\r\n",aktWidth,aktWordWidth);
if( m_cText[pos] == '\n' || if( ((pos < TextChars) && (m_cText[pos] == '\n')) ||
loop == false) loop == false)
{ {
// current line ends with an carriage return, make new line // 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); aktLine.erase(aktLine.size() - 1,1);
m_cLineArray.push_back(aktLine); m_cLineArray.push_back(aktLine);
m_nNrOfLines++; m_nNrOfLines++;