diff --git a/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeUser.mm b/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeUser.mm index db83930d7..0d4db99e9 100644 --- a/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeUser.mm +++ b/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeUser.mm @@ -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]); }