소스 검색

SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs

Sam Lantinga 8 달 전
부모
커밋
23410debf7
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/events/SDL_keyboard.c

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