mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
internal/gamepad: bug fix: crash when XInput and DInput gamepads were connected
Closes #3047
This commit is contained in:
parent
687e505db0
commit
7ab9382424
@ -330,7 +330,12 @@ func (g *nativeGamepadsDesktop) dinput8EnumDevicesCallback(lpddi *_DIDEVICEINSTA
|
|||||||
|
|
||||||
var findErr error
|
var findErr error
|
||||||
if gamepads.find(func(g *Gamepad) bool {
|
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 {
|
if err != nil {
|
||||||
findErr = err
|
findErr = err
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user