Better fix, iterate backwards over the array so we don't care whether the close code shuffles things down.
This commit is contained in:
parent
22e0d6fa53
commit
f98e88676c
1 changed files with 2 additions and 2 deletions
|
@ -403,8 +403,8 @@ SDL_JoystickQuit(void)
|
||||||
/* Stop the event polling */
|
/* Stop the event polling */
|
||||||
SDL_numjoysticks = 0;
|
SDL_numjoysticks = 0;
|
||||||
|
|
||||||
for (i = 0; i < numsticks; i++) {
|
for (i = numjoysticks; i--; ) {
|
||||||
SDL_Joystick *stick = SDL_joysticks[0];
|
SDL_Joystick *stick = SDL_joysticks[i];
|
||||||
if (stick && (stick->ref_count >= 1)) {
|
if (stick && (stick->ref_count >= 1)) {
|
||||||
stick->ref_count = 1;
|
stick->ref_count = 1;
|
||||||
SDL_JoystickClose(stick);
|
SDL_JoystickClose(stick);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue