From 8ce176b59a824cca0458858ffe32542adfea15e7 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Wed, 30 Oct 2024 22:12:25 +0100
Subject: [PATCH] SDL_GetMouseNameForID(): Set an error message for invalid
mouse IDs.
---
src/events/SDL_mouse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 429cc4e97bea8..5e72a1cc0dc2a 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -428,6 +428,7 @@ const char *SDL_GetMouseNameForID(SDL_MouseID instance_id)
{
int mouse_index = SDL_GetMouseIndex(instance_id);
if (mouse_index < 0) {
+ SDL_SetError("Mouse %" SDL_PRIu32 " not found", instance_id);
return NULL;
}
return SDL_GetPersistentString(SDL_mice[mouse_index].name);