openScale
openScale copied to clipboard
java.lang.NullPointerException: no valid characteristic provided
Describe the bug openScale crashes when it shouldn't
To Reproduce Happened only once, so no reproduction
Steps I did when it happened:
- Switched on the scale, stepped on it and started weighting
- Switched on my tablet (while weight was not measured yet) and saw openscale connecting
- Scale showed bluetooth-symbol
- openscale showed currently measured weight as toast
- Scale finished measurements normally
- openscale toast vanished
- I waited some time if the measurement will arrive in the app but it didn't happen
- switched bluetooth off inside openscale and back on
- Crash. (Pretty instant after switching on bluetooth)
- I restarted the app, it didn't connect. I did another measurement, nothing appeared in the app. Tried reconnecting, force close, the usual stuff.
- I removed the batteries of the scale and reinserted them
- Both measurements appeared in openscale and everything is fine again.
Expected behavior
- No crash.
- If possible recovery of weird app-scale state.
Debug log
Scale: Sanitas SBF70
Build version: 2.3.5
Build date: 1981-01-01 01:01:02
Current date: 2021-03-18 11:05:05
Device: Samsung SM-T719
OS version: Android 7.0 (SDK 24)
Stack trace:
java.lang.NullPointerException: no valid characteristic provided
at java.util.Objects.requireNonNull(Objects.java:228)
at com.welie.blessed.BluetoothPeripheral.writeCharacteristic(BluetoothPeripheral.java:1182)
at com.health.openscale.core.bluetooth.BluetoothCommunication.writeBytes(BluetoothCommunication.java:200)
at com.health.openscale.core.bluetooth.BluetoothCommunication.writeBytes(BluetoothCommunication.java:188)
at com.health.openscale.core.bluetooth.BluetoothBeurerSanitas.writeBytes(BluetoothBeurerSanitas.java:573)
at com.health.openscale.core.bluetooth.BluetoothBeurerSanitas.sendAlternativeStartCode(BluetoothBeurerSanitas.java:602)
at com.health.openscale.core.bluetooth.BluetoothBeurerSanitas.onNextStep(BluetoothBeurerSanitas.java:179)
at com.health.openscale.core.bluetooth.BluetoothCommunication.nextMachineStep(BluetoothCommunication.java:460)
at com.health.openscale.core.bluetooth.BluetoothCommunication.nextMachineStep(BluetoothCommunication.java:462)
at com.health.openscale.core.bluetooth.BluetoothCommunication.resumeMachineState(BluetoothCommunication.java:173)
at com.health.openscale.core.bluetooth.BluetoothCommunication$1.onServicesDiscovered(BluetoothCommunication.java:329)
at com.welie.blessed.BluetoothPeripheral$1$1.run(BluetoothPeripheral.java:323)
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:6780)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1500)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1390)
please try out the latest openScale dev version.