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.
@@ -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);
}