Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NULLPointerException , when characterstics is null #50

Closed
RotBolt opened this issue Mar 9, 2019 · 0 comments · Fixed by #349
Closed

NULLPointerException , when characterstics is null #50

RotBolt opened this issue Mar 9, 2019 · 0 comments · Fixed by #349
Labels

Comments

@RotBolt
Copy link

RotBolt commented Mar 9, 2019

Describe the bug
In GattClient, while connecting to gatt , if characterstic is null, it generates Unhandled Exception

To Reproduce
just try to connect any BLE device

Expected behavior
Handle this exception

Logs

Screenshots

2019-03-09 12:36:48.080 22582-22603/com.nilhcem.blenamebadge W/BluetoothGatt: Unhandled exception in callback
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.bluetooth.BluetoothGattCharacteristic.getProperties()' on a null object reference
        at android.bluetooth.BluetoothGatt.writeCharacteristic(BluetoothGatt.java:1155)
        at com.nilhcem.blenamebadge.device.bluetooth.GattClient.writeNextData(GattClient.kt:72)
        at com.nilhcem.blenamebadge.device.bluetooth.GattClient.writeDataStart(GattClient.kt:60)
        at com.nilhcem.blenamebadge.ui.message.MessagePresenter$sendBytes$2$3.invoke(MessagePresenter.kt:49)
        at com.nilhcem.blenamebadge.ui.message.MessagePresenter$sendBytes$2$3.invoke(MessagePresenter.kt:14)
        at com.nilhcem.blenamebadge.device.bluetooth.GattClient$gattCallback$1.onServicesDiscovered(GattClient.kt:42)
        at android.bluetooth.BluetoothGatt$1$5.run(BluetoothGatt.java:328)
        at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:770)
        at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:39)
        at android.bluetooth.BluetoothGatt$1.onSearchComplete(BluetoothGatt.java:323)
        at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:111)
        at android.os.Binder.execTransact(Binder.java:731)
2019-03-09 12:36:48.138 22582-22603/com.nilhcem.blenamebadge D/BluetoothGatt: onConnectionUpdated() - Device=D3:C3:10:49:09:D8 interval=36 latency=0 timeout=500 status=0

Smartphone Info:
Device : Nokia 6.1
Android Version : 9.0 android pie

Would you like to work on the issue?
Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants