Fix an issue where reading out of the list could have been invalid.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3726 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
b3278577bb
commit
a8c4f7f4c1
1 changed files with 4 additions and 2 deletions
|
@ -1023,9 +1023,9 @@ int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int max
|
|||
// scan the width of the line
|
||||
for (px=0, l=0 ; px <= maxpixelwidth; )
|
||||
{
|
||||
if ((start[l]&CON_CHARMASK) == '\n' || (start+l >= end))
|
||||
break;
|
||||
l++;
|
||||
if (start+l >= end || (start[l-1]&CON_CHARMASK) == '\n')
|
||||
break;
|
||||
px = Font_CharEndCoord(px, start[l]);
|
||||
}
|
||||
//if we did get to the end
|
||||
|
@ -1048,6 +1048,8 @@ int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int max
|
|||
break;
|
||||
|
||||
start+=l;
|
||||
if (start == end)
|
||||
break;
|
||||
|
||||
if ((*start&CON_CHARMASK) == '\n'||!l)
|
||||
start++; // skip the \n
|
||||
|
|
Loading…
Reference in a new issue