kkmhogen / KBeaconDemo_Android

Eddystone, iBeacon configruation demo
6 stars 2 forks source link

Crash when sending a command #2

Open 3amoura opened 4 years ago

3amoura commented 4 years ago

When sending a command like ring command

In the sample there is a crash happens inside the library code

java.lang.NullPointerException: Attempt to invoke interface method 'void com.kbeacon.kbeaconlib.KBeacon$ActionCallback.onActionComplete(boolean, com.kbeacon.kbeaconlib.KBException)' on a null object reference at com.kbeacon.kbeaconlib.KBeacon.configHandleDownCmdAck(KBeacon.java:966) at com.kbeacon.kbeaconlib.KBeacon.handleBeaconNtfData(KBeacon.java:1443) at com.kbeacon.kbeaconlib.KBeacon.access$800(KBeacon.java:37) at com.kbeacon.kbeaconlib.KBeacon$2.handleMessage(KBeacon.java:1365) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:210) at android.app.ActivityThread.main(ActivityThread.java:5982) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)

I checked the code compiled by Android Studio and I found this

tmpAction = this.mWriteCmdCallback; this.mWriteCmdCallback = null; this.mWriteCmdCallback.onActionComplete(true, (KBException)null)

In my opinion it should be this

tmpAction = this.mWriteCmdCallback; this.mWriteCmdCallback = null; tmpAction.onActionComplete(true, (KBException)null);

Thanks

kkmhogen commented 3 years ago

Thanks for your feedback. the bug was fixed in version kbeacon library V1.0.5.