Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Better fix, iterate backwards over the array so we don't care whether…
Browse files Browse the repository at this point in the history
… the close code shuffles things down.
  • Loading branch information
slouken committed Nov 29, 2011
1 parent 0ea44e9 commit fe87f98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/joystick/SDL_joystick.c
Expand Up @@ -403,8 +403,8 @@ SDL_JoystickQuit(void)
/* Stop the event polling */
SDL_numjoysticks = 0;

for (i = 0; i < numsticks; i++) {
SDL_Joystick *stick = SDL_joysticks[0];
for (i = numjoysticks; i--; ) {
SDL_Joystick *stick = SDL_joysticks[i];
if (stick && (stick->ref_count >= 1)) {
stick->ref_count = 1;
SDL_JoystickClose(stick);
Expand Down

0 comments on commit fe87f98

Please sign in to comment.