From 30d6cec1bbe0255ea4dbc2e943615e445f313a30 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sun, 26 Oct 2014 17:53:16 +0100 Subject: [PATCH] Added handling of NULL as input for SDL_GameControllerMapping(). For consistency with the similar functions getting SDL_GameController as input. Also NULL is no SDL_GameController and therefore can not have a mapping anyway. --- src/joystick/SDL_gamecontroller.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index fbfc5d4b4caec..e995e2ada3a78 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); }