OneSignal / OneSignal-Unity-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Other
218 stars 60 forks source link

[Bug]: Caused by java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String #684

Closed ajaybirla-fabzen closed 2 months ago

ajaybirla-fabzen commented 4 months ago

What happened?

The application crashes whenever it receives a notification.

Steps to reproduce?

1. Launch the application.
2. Send a notification to the application.
3. Click on the notification.
4. Observe the application crash.

What did you expect to happen?

I expect the app to not crash whenever it receives a notification.

Unity version

2021.3.17f1

OneSignal Unity SDK version

5.0.5

Platform

Android

Relevant log output

Caused by java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String
       at com.onesignal.common.modeling.Model.getStringProperty(Model.kt:216)
       at com.onesignal.common.modeling.Model.getStringProperty$default(Model.kt:216)
       at com.onesignal.common.modeling.Model.getId(Model.kt:62)
       at com.onesignal.common.modeling.ModelStore.get(ModelStore.kt:63)
       at com.onesignal.common.modeling.SingletonModelStore.getModel(SingletonModelStore.kt:22)
       at com.onesignal.inAppMessages.internal.InAppMessagesManager.fetchMessages(InAppMessagesManager.kt:216)
       at com.onesignal.inAppMessages.internal.InAppMessagesManager.access$fetchMessages(InAppMessagesManager.kt:50)
       at com.onesignal.inAppMessages.internal.InAppMessagesManager$onModelReplaced$1.invokeSuspend(InAppMessagesManager.kt:185)
       at com.onesignal.inAppMessages.internal.InAppMessagesManager$onModelReplaced$1.invoke(:8)
       at com.onesignal.inAppMessages.internal.InAppMessagesManager$onModelReplaced$1.invoke(:2)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1$1.invokeSuspend(ThreadUtils.kt:61)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59)
       at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Code of Conduct

shepherd-l commented 2 months ago

Thanks for reporting, this should be fixed in the latest Unity SDK 5.1.1 Release. Feel free to tag me if you are still seeing this issue