AltBeacon / android-beacon-library

Allows Android apps to interact with BLE beacons
Apache License 2.0
2.83k stars 834 forks source link

NPE crash in latest version (2.20.1) in StartupBroadcastReceiver #1166

Closed mlagerberg closed 8 months ago

mlagerberg commented 8 months ago

Expected behavior

Run without crashing

Actual behavior

Crashes with an NPE:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                                        at org.altbeacon.beacon.startup.StartupBroadcastReceiver.onReceive(StartupBroadcastReceiver.java:33)

Steps to reproduce this behavior

Start monitoring with a foreground service.

The error originates from this commit:

https://github.com/AltBeacon/android-beacon-library/commit/b66660ee52c609f698538d4b09f39f9ee4b8ce2f

There should be a null-check around intent.getAction() since the broadcast receiver is not always started with a non-null action.

Mobile device model and OS version

Android Beacon Library version

IMPORTANT: This forum is reserved for feature requests or reproducible bugs with the library itself. If you need help with using the library with your project, please open a new question on StackOverflow.com.

davidgyoung commented 8 months ago

Thanks for this report. A fix is in #1167 and a new release will be available later today.