mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-02 15:47:31 +08:00
SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs
This commit is contained in:
@@ -208,6 +208,7 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id)
|
|||||||
{
|
{
|
||||||
int keyboard_index = SDL_GetKeyboardIndex(instance_id);
|
int keyboard_index = SDL_GetKeyboardIndex(instance_id);
|
||||||
if (keyboard_index < 0) {
|
if (keyboard_index < 0) {
|
||||||
|
SDL_SetError("Keyboard %" SDL_PRIu32 " not found", instance_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name);
|
return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name);
|
||||||
|
|||||||
Reference in New Issue
Block a user