Skip to content

Commit 23410de

Browse files
committed
SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs
1 parent 8ce176b commit 23410de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/events/SDL_keyboard.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id)
208208
{
209209
int keyboard_index = SDL_GetKeyboardIndex(instance_id);
210210
if (keyboard_index < 0) {
211+
SDL_SetError("Keyboard %" SDL_PRIu32 " not found", instance_id);
211212
return NULL;
212213
}
213214
return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name);

0 commit comments

Comments
 (0)