From c1da39a245768a3867cd4377e855980e1f1bc42a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 3 Mar 2024 11:07:39 -0800 Subject: [PATCH] SDL_GetGamepadAppleSFSymbolsNameForButton() returns NULL if the symbol isn't found Fixes https://github.com/libsdl-org/SDL/issues/9071 --- src/joystick/SDL_gamepad.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index 6574b66554..e7f55880c2 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -3750,10 +3750,11 @@ const char *SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_ } SDL_UnlockJoysticks(); - return retval; -#else - return NULL; + if (retval && *retval) { + return retval; + } #endif + return NULL; } const char *SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)