rkokkelk / homey-wear

WearOS app for the Athom Homey
MIT License
0 stars 2 forks source link

Wear app crashes on some devices #1

Open RoadXY opened 4 years ago

RoadXY commented 4 years ago

Ik heb mijn Toon, twee Plugwise apparaten, Tado Airco en OpenWeatherMap als favoriet staan. Deze crashen allemaal. Zojuist even met een virtuele schakelaar getest: dat werkt wel.

RoadXY commented 4 years ago

2020-10-14 17:10:07.266 8144-8144/com.xseth.homey E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xseth.homey, PID: 8144 java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.Map.containsKey(java.lang.Object)' on a null object reference at com.xseth.homey.adapters.OnOffAdapter$1.onResponse(OnOffAdapter.java:147) at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89) at retrofit2.-$$Lambda$DefaultCallAdapterFactory$ExecutorCallbackCall$1$3wC8FyV4pyjrzrYL5U0mlYiviZw.run(lambda) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

RoadXY commented 4 years ago

Found it: https://github.com/rkokkelk/homey-wear/blob/master/app/src/main/java/com/xseth/homey/homey/models/Device.java#L143

If the devices doesn't have one of the app supported capabilities, it get's the on/off capability by default. When the users tries to switch the device the app crashes because the device can't be switched.