internal/gamepad: bug fix: getGamepads might not be available under a non-secure context

Closes #2100
This commit is contained in:
Hajime Hoshi 2022-05-21 23:22:48 +09:00
parent 6fa39d5e73
commit 8d318fc4de

View File

@ -47,6 +47,11 @@ func (g *nativeGamepads) update(gamepads *gamepads) error {
return nil
}
// getGamepads might not exist under a non-secure context (#2100).
if !nav.Get("getGamepads").Truthy() {
return nil
}
gps := nav.Call("getGamepads")
if !gps.Truthy() {
return nil