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

[Bug]: NullPointerException in PermissionsActivity.reregisterCallbackHandlers #2215

Open
1 task done
koral-- opened this issue Nov 19, 2024 · 1 comment
Open
1 task done

Comments

@koral--
Copy link

koral-- commented Nov 19, 2024

What happened?

App crashed due to the exception attached in the log.

It seems that the issue is here: https://github.com/OneSignal/OneSignal-Android-SDK/blob/main/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt#L58
and extras turned out to be null.
At the line above the affected one there is a nullable parameter: https://github.com/OneSignal/OneSignal-Android-SDK/blob/main/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt#L57

Regardless of the root cause it does not make sense to have a nullable parameter and then immediately use a non-null assertion operator on it. The parameter should be either non-nullable or there should be a nullcheck.

Steps to reproduce?

Unknown, it's an automated crash report.
From the stacktrace I guess it is related to app start.

What did you expect to happen?

No crash.

OneSignal Android SDK version

5.1.23

Android version

12

Specific Android models

* Pixel 3a

Relevant log output

java.lang.RuntimeException: Unable to start activity ComponentInfo{<stripped app id>/com.onesignal.core.activities.PermissionsActivity}: java.lang.NullPointerException
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3635)

(stripped stacktrace entries from android framework)

Caused by: java.lang.NullPointerException: 
    com.onesignal.core.activities.PermissionsActivity.reregisterCallbackHandlers(PermissionsActivity.kt)
    com.onesignal.core.activities.PermissionsActivity.handleBundleParams(PermissionsActivity.kt)
    com.onesignal.core.activities.PermissionsActivity.onCreate(PermissionsActivity.kt:32)
    android.app.Activity.performCreate(Activity.java:8051)

(stripped stacktrace entries from android framework)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jinliu9508
Copy link
Contributor

Hello @koral--, thanks for reporting this to us, we will look into this and let you know as soon as possible.

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

2 participants