Commit 24f97dd700a883437c1bdc375988cfc7163b262e

Sam Lantinga 2022-08-11T14:39:49

Added an SDL error to SDL_GameControllerMapping* functions

diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 6b45340..4d79d9b 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -1614,6 +1614,8 @@ SDL_GameControllerMappingForIndex(int mapping_index)
             return CreateMappingString(mapping, mapping->guid);
         }
         --mapping_index;
+    } else {
+        SDL_SetError("Mapping not available");
     }
     return NULL;
 }
@@ -1627,6 +1629,8 @@ SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
     ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_FALSE);
     if (mapping) {
         return CreateMappingString(mapping, guid);
+    } else {
+        SDL_SetError("Mapping not available");
     }
     return NULL;
 }