From 23410debf7ad2d05d4662ed38af110e43b2e3a14 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 00:01:06 -0800 Subject: [PATCH] SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs --- src/events/SDL_keyboard.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 0ad2ff6dde..e4664fba6d 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -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);