Commit 4295a6fe47916a841988e09d668dc589b939abb3

Ryan C. Gordon 2015-09-13T11:29:45

Mac: Fixed off-by-one bug when plugging in a joystick (thanks, Konstantin!).

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c
index 2b5f591..e9a028b 100644
--- a/src/joystick/darwin/SDL_sysjoystick.c
+++ b/src/joystick/darwin/SDL_sysjoystick.c
@@ -465,6 +465,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
             curdevice = curdevice->pNext;
         }
         curdevice->pNext = device;
+        ++device_index;  /* bump by one since we counted by pNext. */
     }
 
 /* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceAdded()? */