Skip to content

Commit

Permalink
Merge branch 'openfl:develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
MAJigsaw77 authored Dec 1, 2023
2 parents 1b3bd27 + c40ec31 commit dd8f112
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/lime/ui/Joystick.hx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ class Joystick
#if (js && html5)
@:noCompletion private static function __getDeviceData():Array<Dynamic>
{
return
(untyped navigator.getGamepads) ? untyped navigator.getGamepads() : (untyped navigator.webkitGetGamepads) ? untyped navigator.webkitGetGamepads() : null;
var res:Dynamic = null;

try
{
res = (untyped navigator.getGamepads) ? untyped navigator.getGamepads() : (untyped navigator.webkitGetGamepads) ? untyped navigator.webkitGetGamepads() : null;
}
catch (err:Dynamic)
{
// if something went wrong, treat it the same as when navigator.getGamepads doesn't exist
// we probably don't have permission to use this feature
}

return res;
}
#end

Expand Down

0 comments on commit dd8f112

Please sign in to comment.