engine: client: cl_font: fix possible NULL dereference

This commit is contained in:
Alibek Omarov 2024-11-05 21:15:44 +03:00
parent ec73f23e4a
commit f95ce7f52d

View file

@ -368,9 +368,12 @@ void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height,
{ {
draw_len += font->charWidths[number]; draw_len += font->charWidths[number];
if( width )
{
if( draw_len > *width ) if( draw_len > *width )
*width = draw_len; *width = draw_len;
} }
}
s++; s++;
} }