瀏覽代碼

SDL_GetMouseNameForID(): Set an error message for invalid mouse IDs.

Petar Popovic 10 月之前
父節點
當前提交
8ce176b59a
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/events/SDL_mouse.c

+ 1 - 0
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);