Fix offset used before range check

This use of offset 'i' should follow the range check.
This commit is contained in:
Mingjie Shen 2023-04-21 01:39:23 -04:00
parent 535680668b
commit 56b17bf4f1

View File

@ -3743,7 +3743,7 @@ static int GetTextWidth(const char *text)
{
if (text[0] == '#')
{
for (int i = 1; (text[i] != '\0') && (i < 5); i++)
for (int i = 1; (i < 5) && (text[i] != '\0'); i++)
{
if (text[i] == '#')
{