Skip to content

Commit 38cbc73

Browse files
authored
Merge pull request #2745 from brandonpage/fix-push-reg-npe
Fix NPE when attempting push registration upon login.
2 parents b2a169b + 5e40cff commit 38cbc73

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

libs/SalesforceSDK/src/com/salesforce/androidsdk/push/PushService.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,7 @@ open class PushService {
385385
account: UserAccount,
386386
restClient: RestClient
387387
): String? {
388-
389388
val sdkManager = SalesforceSDKManager.getInstance()
390-
val accountManager = UserAccountManager.getInstance()
391389

392390
runCatching {
393391
val fields: MutableMap<String, String?> = mutableMapOf(
@@ -397,9 +395,9 @@ open class PushService {
397395
)
398396

399397
// Adds community ID to the registration payload to allow scoping of notifications per community.
400-
val communityId = accountManager.currentUser.communityId
401-
if (communityId?.isNotEmpty() == true) {
402-
fields[NETWORK_ID] = communityId
398+
val communityUrl = account.communityUrl
399+
if (!communityUrl.isNullOrBlank()) {
400+
fields[NETWORK_ID] = communityUrl
403401
}
404402

405403
// Adds an RSA public key to the registration payload if available.

0 commit comments

Comments
 (0)