Added an SDL error to SDL_GameControllerMapping* functions

This commit is contained in:
Sam Lantinga 2022-08-11 14:39:49 -07:00
parent 9f30d4981e
commit 24f97dd700
1 changed files with 4 additions and 0 deletions

View File

@ -1614,6 +1614,8 @@ SDL_GameControllerMappingForIndex(int mapping_index)
return CreateMappingString(mapping, mapping->guid); return CreateMappingString(mapping, mapping->guid);
} }
--mapping_index; --mapping_index;
} else {
SDL_SetError("Mapping not available");
} }
return NULL; return NULL;
} }
@ -1627,6 +1629,8 @@ SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_FALSE); ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_FALSE);
if (mapping) { if (mapping) {
return CreateMappingString(mapping, guid); return CreateMappingString(mapping, guid);
} else {
SDL_SetError("Mapping not available");
} }
return NULL; return NULL;
} }