Skip to content

Device name can be null in some circumstances #61

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

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

microbit-matt-hillsdon
Copy link

@martinwork
Copy link
Collaborator

I can't see the link (presumably crash report). The change looks good.

@microbit-matt-hillsdon
Copy link
Author

Sorry Martin. Trace from the crash report for context (Android 14):

Exception java.lang.RuntimeException:
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0 (LoadedApk.java:1876)
  at android.app.LoadedApk$ReceiverDispatcher$Args.$r8$lambda$gDuJqgxY6Zb-ifyeubKeivTLAwk
  at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:222)
  at android.os.Looper.loop (Looper.java:314)
  at android.app.ActivityThread.main (ActivityThread.java:8706)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:565)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1081)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.isEmpty()' on a null object reference
  at com.samsung.microbit.utils.BLEPair$9.onReceive (BLEPair.java:646)
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0 (LoadedApk.java:1866)

@martinwork
Copy link
Collaborator

That proves it can happen! I haven't seen it on Android 8.1, 12, 13 or 14. If I had been thinking, I might have checked addr and action too.

@microbit-matt-hillsdon microbit-matt-hillsdon merged commit eaea9ad into main Apr 30, 2024
@microbit-matt-hillsdon microbit-matt-hillsdon deleted the guard-null-name branch April 30, 2024 14:59
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

Successfully merging this pull request may close these issues.

2 participants