diff --git a/engine/client/console.c b/engine/client/console.c index 23bc72e45..01042cac9 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -2024,7 +2024,7 @@ char *Con_CopyConsole(qboolean nomarkup, qboolean onlyiflink) if (*cur == CON_LINKSTART) break; } - while (finalendoffset < con->selendline->length) + while (finalendoffset < l->length) { uc = (((conchar_t*)(l+1))[finalendoffset] & CON_CHARMASK); if (uc != ' ' && uc != '\t' && ((conchar_t*)(l+1))[finalendoffset] != CON_LINKEND) @@ -2034,9 +2034,9 @@ char *Con_CopyConsole(qboolean nomarkup, qboolean onlyiflink) } } } - + //scan backwards to find any link enclosure - for(lend = cur; lend >= (conchar_t*)(l+1); lend--) + for(lend = cur-1; lend >= (conchar_t*)(l+1); lend--) { if (*lend == CON_LINKSTART) { @@ -2051,7 +2051,7 @@ char *Con_CopyConsole(qboolean nomarkup, qboolean onlyiflink) } } //scan forwards to find the end of the selected link - if (*cur == CON_LINKSTART) + if (l->length && *cur == CON_LINKSTART) { for(lend = (conchar_t*)(con->selendline+1) + finalendoffset; lend < (conchar_t*)(con->selendline+1) + con->selendline->length; lend++) { diff --git a/engine/gl/gl_font.c b/engine/gl/gl_font.c index 239cbbe81..51e4abc04 100644 --- a/engine/gl/gl_font.c +++ b/engine/gl/gl_font.c @@ -1570,8 +1570,8 @@ int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int max { if (start+l >= end || (start[l]&(CON_CHARMASK|CON_HIDDEN)) == '\n') break; - l++; px = Font_CharEndCoord(font, px, start[l]); + l++; } //if we did get to the end if (px > maxpixelwidth)