Skip to content

Commit

Permalink
Merge pull request #697 from OneSignal/fix/iOSNullPushSubIdAndToken
Browse files Browse the repository at this point in the history
[Fix] iOS Null PushSubscription Id and Token crash
  • Loading branch information
shepherd-l authored and jinliu9508 committed Feb 27, 2024
2 parents c1bf827 + 451382d commit 381e121
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions OneSignalExample/Assets/OneSignal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- iOS crash when calling OneSignal.User.PushSubscription.Id and OneSignal.User.PushSubscription.Token when they are null.

## [5.0.6]
### Fixed
- Duplicate symbol errors when building with other iOS plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,16 @@ void _oneSignalUserRemoveTags(const char* tagsJson) {
}

const char* _oneSignalPushSubscriptionGetId() {
if (OneSignal.User.pushSubscription.id == NULL) {
return NULL;
}
return strdup([OneSignal.User.pushSubscription.id UTF8String]);
}

const char* _oneSignalPushSubscriptionGetToken() {
if (OneSignal.User.pushSubscription.token == NULL) {
return NULL;
}
return strdup([OneSignal.User.pushSubscription.token UTF8String]);
}

Expand Down

0 comments on commit 381e121

Please sign in to comment.