Browse Source

fix SDL_FindFreePlayerIndex so it can really return -1.

Ozkan Sezer 2 năm trước cách đây
mục cha
commit
53bde3abee
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/joystick/SDL_joystick.c

+ 2 - 2
src/joystick/SDL_joystick.c

@@ -198,7 +198,7 @@ static SDL_bool SDL_GetDriverAndJoystickIndex(SDL_JoystickID instance_id, SDL_Jo
 
 static int SDL_FindFreePlayerIndex(void)
 {
-    int player_index = -1;
+    int player_index;
 
     SDL_AssertJoysticksLocked();
 
@@ -207,7 +207,7 @@ static int SDL_FindFreePlayerIndex(void)
             return player_index;
         }
     }
-    return player_index;
+    return -1;
 }
 
 static int SDL_GetPlayerIndexForJoystickID(SDL_JoystickID instance_id)