Security check in case of not valid font

This commit is contained in:
Ray 2021-05-03 19:05:43 +02:00
parent 4c1af4cc90
commit 2015828fc6

View file

@ -848,6 +848,8 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
// NOTE: chars spacing is NOT proportional to fontSize // NOTE: chars spacing is NOT proportional to fontSize
void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
{ {
if (font.texture.id == 0) font = GetFontDefault(); // Security check in case of not valid font
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
int textOffsetY = 0; // Offset between lines (on line break '\n') int textOffsetY = 0; // Offset between lines (on line break '\n')