Browse Source

Fixed initializing XInput user index

Sam Lantinga 6 years ago
parent
commit
545febcf21
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/joystick/SDL_joystick.c

+ 1 - 1
src/joystick/SDL_joystick.c

@@ -307,6 +307,7 @@ SDL_JoystickOpen(int device_index)
     joystick->driver = driver;
     joystick->instance_id = instance_id;
     joystick->attached = SDL_TRUE;
+    joystick->userid = -1;
 
     if (driver->Open(joystick, device_index) < 0) {
         SDL_free(joystick);
@@ -322,7 +323,6 @@ SDL_JoystickOpen(int device_index)
     }
 
     joystick->guid = driver->GetDeviceGUID(device_index);
-    joystick->userid = -1;
 
     if (joystick->naxes > 0) {
         joystick->axes = (SDL_JoystickAxisInfo *) SDL_calloc(joystick->naxes, sizeof(SDL_JoystickAxisInfo));