mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 23:06:03 +00:00
SDL_GetMouseNameForID(): Set an error message for invalid mouse IDs.
This commit is contained in:

committed by
Sam Lantinga

parent
51fa076fdc
commit
8ce176b59a
@@ -428,6 +428,7 @@ const char *SDL_GetMouseNameForID(SDL_MouseID instance_id)
|
|||||||
{
|
{
|
||||||
int mouse_index = SDL_GetMouseIndex(instance_id);
|
int mouse_index = SDL_GetMouseIndex(instance_id);
|
||||||
if (mouse_index < 0) {
|
if (mouse_index < 0) {
|
||||||
|
SDL_SetError("Mouse %" SDL_PRIu32 " not found", instance_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return SDL_GetPersistentString(SDL_mice[mouse_index].name);
|
return SDL_GetPersistentString(SDL_mice[mouse_index].name);
|
||||||
|
Reference in New Issue
Block a user