From ac74f39c031678ad91f673ac9c78db60b9abe660 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Mon, 7 Oct 2024 23:40:57 +0300 Subject: [PATCH] twn_text.c: discard empty inputs --- src/rendering/twn_text.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rendering/twn_text.c b/src/rendering/twn_text.c index c54d57b..71d0676 100644 --- a/src/rendering/twn_text.c +++ b/src/rendering/twn_text.c @@ -253,6 +253,9 @@ void draw_text(const char *string, Vec2 position, int height_px, Color color, co /* the original string might not be around by the time it's used, so copy it */ size_t str_length = SDL_strlen(string) + 1; + if (str_length == 1) + /* empty string */ + return; char *dup_string = string_arena_alloc(&string_arena, str_length); SDL_strlcpy(dup_string, string, str_length);