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

Origin commit data
------------------
Commit: b014b965f4
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-05-10 (Thu, 10 May 2012)
This commit is contained in:
[CST] Focus
2012-05-10 11:39:54 +04:00
parent 826f04fdad
commit a2be692de6

View File

@@ -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++;