{"comment":{"url":"https://api.github.com/repos/speps/XInputDotNet/comments/10177512","html_url":"https://github.com/speps/XInputDotNet/commit/ae1c0a9057c2d99a2e1118032934a74daa6fb05e#commitcomment-10177512","id":10177512,"user":{"login":"dantreble","id":3644118,"avatar_url":"https://avatars.githubusercontent.com/u/3644118?v=3","gravatar_id":"","url":"https://api.github.com/users/dantreble","html_url":"https://github.com/dantreble","followers_url":"https://api.github.com/users/dantreble/followers","following_url":"https://api.github.com/users/dantreble/following{/other_user}","gists_url":"https://api.github.com/users/dantreble/gists{/gist_id}","starred_url":"https://api.github.com/users/dantreble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantreble/subscriptions","organizations_url":"https://api.github.com/users/dantreble/orgs","repos_url":"https://api.github.com/users/dantreble/repos","events_url":"https://api.github.com/users/dantreble/events{/privacy}","received_events_url":"https://api.github.com/users/dantreble/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"ae1c0a9057c2d99a2e1118032934a74daa6fb05e","created_at":"2015-03-13T01:31:52Z","updated_at":"2015-03-13T01:31:52Z","body":"I don't have a machine with XInput 1.0.9 but no 1.4, but one of our users did. I can't explain it, but it's out there!\r\n\r\nI also changed \r\nmLoaded = mGetState != NULL && mSetState != NULL;\r\n\r\nMade ensureLoaded, return mLoaded\r\n\r\nAnd checked it before dereferencing it \r\n\r\nDWORD XInputGamePadGetState(DWORD dwUserIndex, XINPUT_STATE* pState)\r\n{\r\n\tif(gXInputLoader.ensureLoaded())\r\n\t{\r\n\t\treturn gXInputLoader.mGetState(dwUserIndex, pState);\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn 1167; //ERROR_DEVICE_NOT_CONNECTED\r\n\t}\r\n}\r\n\r\nSo I don't crash now :-)"}}