summaryrefslogtreecommitdiffhomepage
path: root/examples/shapes
diff options
context:
space:
mode:
authorMingjie Shen <[email protected]>2023-04-22 04:13:11 -0400
committerGitHub <[email protected]>2023-04-22 10:13:11 +0200
commit7b7c0c83ef3d52695b7c939ad181e7ca3faddbf6 (patch)
treea0d4400e9f607fa2a418f6562cdb6496bbb44631 /examples/shapes
parent535680668be3ca2e688a73132150c16f0160e0cc (diff)
downloadraylib-7b7c0c83ef3d52695b7c939ad181e7ca3faddbf6.tar.gz
raylib-7b7c0c83ef3d52695b7c939ad181e7ca3faddbf6.zip
Fix offset used before range check (#3021)
This use of offset 'i' should follow the range check.
Diffstat (limited to 'examples/shapes')
-rw-r--r--examples/shapes/raygui.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/shapes/raygui.h b/examples/shapes/raygui.h
index 112370ac..ea95e5c8 100644
--- a/examples/shapes/raygui.h
+++ b/examples/shapes/raygui.h
@@ -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] == '#')
{