2
0
Ray 9 сар өмнө
parent
commit
d15e583460
1 өөрчлөгдсөн 3 нэмэгдсэн , 2 устгасан
  1. 3 2
      src/rtext.c

+ 3 - 2
src/rtext.c

@@ -1282,7 +1282,8 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
 {
 {
     Vector2 textSize = { 0 };
     Vector2 textSize = { 0 };
 
 
-    if ((isGpuReady && (font.texture.id == 0)) || (text == NULL)) return textSize; // Security check
+    if ((isGpuReady && (font.texture.id == 0)) || 
+        (text == NULL) || (text[0] == '\0')) return textSize; // Security check
 
 
     int size = TextLength(text);    // Get size in bytes of text
     int size = TextLength(text);    // Get size in bytes of text
     int tempByteCounter = 0;        // Used to count longer text line num chars
     int tempByteCounter = 0;        // Used to count longer text line num chars
@@ -1327,7 +1328,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
 
 
     if (tempTextWidth < textWidth) tempTextWidth = textWidth;
     if (tempTextWidth < textWidth) tempTextWidth = textWidth;
 
 
-    if (size > 0) textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
+    textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
     textSize.y = textHeight;
     textSize.y = textHeight;
 
 
     return textSize;
     return textSize;