Browse Source

Fix offset used before range check (#3021)

This use of offset 'i' should follow the range check.
Mingjie Shen 2 years ago
parent
commit
7b7c0c83ef
1 changed files with 1 additions and 1 deletions
  1. 1 1
      examples/shapes/raygui.h

+ 1 - 1
examples/shapes/raygui.h

@@ -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] == '#')
                 {
                 {