From 959fe9a938dedea3b34fdffc657817d16e4aaa1c Mon Sep 17 00:00:00 2001 From: jinliu9508 Date: Mon, 2 Dec 2024 18:01:56 -0500 Subject: [PATCH] fix: add null check for extras --- .../java/com/onesignal/core/activities/PermissionsActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt b/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt index 00367476fe..0140bffe93 100644 --- a/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt +++ b/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt @@ -22,7 +22,8 @@ class PermissionsActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (!OneSignal.initWithContext(this)) { + // unable to request for permission if initWithContext is not called or savedInstanceState is null + if (!OneSignal.initWithContext(this) || savedInstanceState == null) { return }