From bf377537a617218c7ff310d682b2b8aa0a67a613 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 2 Dec 2024 11:02:57 -0500 Subject: [PATCH] Fix handling of NULL button name --- src/swgrpha.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/swgrpha.c b/src/swgrpha.c index 668cac0..13ffa6d 100644 --- a/src/swgrpha.c +++ b/src/swgrpha.c @@ -69,6 +69,7 @@ void swputsym(int x, int y, OBJECTS * ob) static void PrintHelp(void) { + const char *name; char buf[64]; int i; const struct { @@ -115,8 +116,11 @@ static void PrintHelp(void) swposcur(1, i + 3); swputs(buf); if (Vid_HaveController()) { - swposcur(21, i + 3); - swputs(Vid_ControllerButtonName(items[i].key)); + name = Vid_ControllerButtonName(items[i].key); + if (name != NULL) { + swposcur(21, i + 3); + swputs(name); + } } } snprintf(buf, sizeof(buf), "%-11s- %s", "Restart", "Ctrl-R");