Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

fix when PhoneStateListener is not ready for use #387

Merged
merged 1 commit into from
May 5, 2020
Merged

fix when PhoneStateListener is not ready for use #387

merged 1 commit into from
May 5, 2020

Conversation

marandaneto
Copy link
Contributor

@marandaneto marandaneto commented May 5, 2020

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

fix when PhoneStateListener is not ready for use
probably because Looper.myLooper() returns null, but I can't find out how

💡 Motivation and Context

java.lang.RuntimeException: Unable to create application package_here: java.lang.NullPointerException: Attempt to read from field 'android.os.MessageQueue android.os.Looper.mQueue' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6465)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to read from field 'android.os.MessageQueue android.os.Looper.mQueue' on a null object reference
at android.os.Handler.(Handler.java:237)
at android.os.Handler.(Handler.java:142)
at android.telephony.PhoneStateListener.(PhoneStateListener.java:420)
at android.telephony.PhoneStateListener.(PhoneStateListener.java:385)
at io.sentry.android.core.PhoneStateBreadcrumbsIntegration$PhoneStateChangeListener.(PhoneStateBreadcrumbsIntegration.java:76)
at io.sentry.android.core.PhoneStateBreadcrumbsIntegration.register(PhoneStateBreadcrumbsIntegration.java:50)
at io.sentry.core.Hub.(Hub.java:38)
at io.sentry.core.Sentry.init(Sentry.java:144)
at io.sentry.core.Sentry.init(Sentry.java:92)
at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:59)
at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:44)

💚 How did you test it?

I didn't, could not reproduce it, but an NPE check doesn't hurt.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing

🔮 Next steps

@marandaneto marandaneto merged commit 6f7f38a into getsentry:master May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants