From bebf6d6b5f6190de875e23e5a2ad1d1f304f86c2 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 2 Jul 2022 04:50:50 +0200 Subject: font.c: set null dimensions on null str --- src/font/src/font.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/font/src/font.c b/src/font/src/font.c index 1e1bb6c..ab6865a 100644 --- a/src/font/src/font.c +++ b/src/font/src/font.c @@ -9,6 +9,17 @@ static int renderstr(const enum font f, const short x, short y, const char *str, const bool render, short *const max_x, short *const max_y) { + if (!str) + { + if (max_x) + *max_x = 0; + + if (max_y) + *max_y = 0; + + return 0; + } + static const struct cfg { const struct sprite *s; -- cgit v1.2.3