diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index fbfc5d4b4..e995e2ada 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -746,6 +746,10 @@ SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid) char * SDL_GameControllerMapping(SDL_GameController * gamecontroller) { + if (!gamecontroller) { + return NULL; + } + return SDL_GameControllerMappingForGUID(gamecontroller->mapping.guid); }