mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/gamepad: bug fix: crash when XInput and DInput gamepads were connected
Closes #3047
This commit is contained in:
parent
e5bb046a11
commit
29946d037b
@ -329,7 +329,12 @@ func (g *nativeGamepadsDesktop) dinput8EnumDevicesCallback(lpddi *_DIDEVICEINSTA
|
||||
|
||||
var findErr error
|
||||
if gamepads.find(func(g *Gamepad) bool {
|
||||
path, err := getDInputPath(g.native.(*nativeGamepadDesktop).dinputDevice)
|
||||
// A DInput device can be nil when the device is an XInput device (#3047).
|
||||
d := g.native.(*nativeGamepadDesktop).dinputDevice
|
||||
if d == nil {
|
||||
return false
|
||||
}
|
||||
path, err := getDInputPath(d)
|
||||
if err != nil {
|
||||
findErr = err
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user