Check bounds before, not after.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3296 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-07-18 09:33:30 +00:00
parent a55a2326f2
commit db97dd67d0

View file

@ -994,7 +994,7 @@ static int Con_LineBreaks(conchar_t *start, conchar_t *end, int scrwidth, int ma
// scan the width of the line // scan the width of the line
for (px=0, l=0 ; px <= scrwidth;) for (px=0, l=0 ; px <= scrwidth;)
{ {
if ((start[l]&CON_CHARMASK) == '\n' || (start+l >= end)) if (start+l >= end || (start[l]&CON_CHARMASK) == '\n')
break; break;
l++; l++;
px += Font_CharWidth(start[l]); px += Font_CharWidth(start[l]);