Browse Source

SDL_GameControllerGetAppleSFSymbolsNameForButton() returns NULL if the symbol isn't found

Fixes https://github.com/libsdl-org/SDL/issues/9071

(cherry picked from commit b87116ff03366b5d3590ae31274042f0a964dc25)
Sam Lantinga 1 year ago
parent
commit
c1149f88b6
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/joystick/SDL_gamecontroller.c

+ 4 - 3
src/joystick/SDL_gamecontroller.c

@@ -3259,10 +3259,11 @@ const char *SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController
     }
     SDL_UnlockJoysticks();
 
-    return retval;
-#else
-    return NULL;
+    if (retval && *retval) {
+        return retval;
+    }
 #endif
+    return NULL;
 }
 
 const char *SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)