Skip to content

Commit

Permalink
SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard…
Browse files Browse the repository at this point in the history
… IDs
  • Loading branch information
slouken committed Jan 15, 2025
1 parent 8ce176b commit 23410de
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/events/SDL_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id)
{
int keyboard_index = SDL_GetKeyboardIndex(instance_id);
if (keyboard_index < 0) {
SDL_SetError("Keyboard %" SDL_PRIu32 " not found", instance_id);
return NULL;
}
return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name);
Expand Down

0 comments on commit 23410de

Please sign in to comment.