RainwayApp / flutter_gamepad

A gamepad library for Flutter
Apache License 2.0
36 stars 18 forks source link

Fixed crash with null. #7

Closed apecoraro closed 4 years ago

apecoraro commented 4 years ago

The getDevice function can return null, so need to check for that when checking if an input is from a gamepad.

Probably a fix for this crash that was picked up by Google Play:

java.lang.IllegalStateException:
  at com.example.flutter_gamepad.GamepadStreamHandlerKt.a (GamepadStreamHandlerKt.java:15)
  at com.example.flutter_gamepad.GamepadStreamHandler.a (GamepadStreamHandler.java:14)
  at com.example.flutter_gamepad.GamepadAndroidKeyProcessor.onKeyUp (GamepadAndroidKeyProcessor.java:7)
  at io.flutter.view.FlutterView.onKeyUp (FlutterView.java:13)
  at android.view.KeyEvent.dispatch (KeyEvent.java:2847)
  at android.view.View.dispatchKeyEvent (View.java:13389)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1942)