Fix offset used before range check (#3021)

This use of offset 'i' should follow the range check.
This commit is contained in:
Mingjie Shen 2023-04-22 04:13:11 -04:00 committed by GitHub
parent 535680668b
commit 7b7c0c83ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3743,7 +3743,7 @@ static int GetTextWidth(const char *text)
{ {
if (text[0] == '#') 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] == '#') if (text[i] == '#')
{ {