Added handling of NULL as input for SDL_GameControllerMapping().
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 26 Oct 2014 17:53:16 +0100
changeset 9196 3c3a84b56da0
parent 9195 e390d259582b
child 9197 90bb83c49dea
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
--- a/src/joystick/SDL_gamecontroller.c	Sun Oct 26 17:46:11 2014 +0100
+++ b/src/joystick/SDL_gamecontroller.c	Sun Oct 26 17:53:16 2014 +0100
@@ -746,6 +746,10 @@
 char *
 SDL_GameControllerMapping(SDL_GameController * gamecontroller)
 {
+    if (!gamecontroller) {
+        return NULL;
+    }
+
     return SDL_GameControllerMappingForGUID(gamecontroller->mapping.guid);
 }