From f5122377c936905d478250a4d142b55d924ebdda Mon Sep 17 00:00:00 2001 From: Dimitriy Ryazantcev Date: Thu, 10 Jun 2021 14:06:32 +0300 Subject: [PATCH] Move SDL_IsXInputDevice check above actual joystick allocation --- src/joystick/windows/SDL_dinputjoystick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index 8552d9f65..98c6499ed 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/src/joystick/windows/SDL_dinputjoystick.c @@ -446,6 +446,8 @@ EnumJoysticksCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) CHECK(QueryDevicePath(device, &hidPath)); CHECK(QueryDeviceInfo(device, &vendor, &product)); + CHECK(!SDL_IsXInputDevice(vendor, product, hidPath)); + pNewJoystick = *(JoyStick_DeviceData**)pContext; while (pNewJoystick) { /* update GUIDs of joysticks with matching paths, in case they're not open yet */ @@ -499,8 +501,6 @@ EnumJoysticksCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4); } - CHECK(!SDL_IsXInputDevice(vendor, product, hidPath)); - CHECK(!SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)); #ifdef SDL_JOYSTICK_HIDAPI