From 24f97dd700a883437c1bdc375988cfc7163b262e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 11 Aug 2022 14:39:49 -0700
Subject: [PATCH] Added an SDL error to SDL_GameControllerMapping* functions
---
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 6b45340383c..4d79d9bf169 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;
}