소스 검색

fix SDL_FindFreePlayerIndex so it can really return -1.

Ozkan Sezer 2 년 전
부모
커밋
a70964aaf4
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/joystick/SDL_joystick.c

+ 2 - 2
src/joystick/SDL_joystick.c

@@ -202,7 +202,7 @@ static SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriv
 
 
 static int SDL_FindFreePlayerIndex()
 static int SDL_FindFreePlayerIndex()
 {
 {
-    int player_index = -1;
+    int player_index;
 
 
     SDL_AssertJoysticksLocked();
     SDL_AssertJoysticksLocked();
 
 
@@ -211,7 +211,7 @@ static int SDL_FindFreePlayerIndex()
             return player_index;
             return player_index;
         }
         }
     }
     }
-    return player_index;
+    return -1;
 }
 }
 
 
 static int SDL_GetPlayerIndexForJoystickID(SDL_JoystickID instance_id)
 static int SDL_GetPlayerIndexForJoystickID(SDL_JoystickID instance_id)