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

Getting NPE in ReadRequest on BleReadCallback #115

Open
ivbabar opened this issue Jul 14, 2023 · 0 comments
Open

Getting NPE in ReadRequest on BleReadCallback #115

ivbabar opened this issue Jul 14, 2023 · 0 comments

Comments

@ivbabar
Copy link

ivbabar commented Jul 14, 2023

I'm using this code to read firmware version of the connected BLE device and I doubt this code is causing this exception

    ```
Ble.getInstance().read(Ble.getInstance().getBleDevice(0), new BleReadCallback<BleDevice>() {
                    @Override
                    public void onReadSuccess(BluetoothGattCharacteristic characteristic) {

                        if (characteristic != null || characteristic.getStringValue(0) != null) {
                            fwVersion = characteristic.getStringValue(0);
                            Log.d(TAG, "Remote controller firmware version: " + fwVersion);
                        }

//                        locker.release();
                    }
                });

Here is the exception i'm getting on Crashlytic

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void cn.com.heaton.blelibrary.ble.callback.BleReadCallback.onReadSuccess(android.bluetooth.BluetoothGattCharacteristic)' on a null object reference
       at cn.com.heaton.blelibrary.ble.request.ReadRequest.handleMessage(ReadRequest.java:44)
       at cn.com.heaton.blelibrary.ble.BleHandler.handleMessage(BleHandler.java:48)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8680)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
       
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant