stream-chat-android icon indicating copy to clipboard operation
stream-chat-android copied to clipboard

NullPointerException on MutableClientState.setUser

Open donlan opened this issue 1 year ago • 1 comments

Describe the bug

Crash tracks:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Class.isInterface()' on a null object reference
       at java.lang.Class.isAssignableFrom(Class.java:824)
       at java.lang.Class.isInstance(Class.java:774)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.accessCheck(AtomicReferenceFieldUpdater.java:421)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.get(AtomicReferenceFieldUpdater.java:479)
       at kotlinx.coroutines.flow.StateFlowSlot.makePending(StateFlow.kt:268)
       at kotlinx.coroutines.flow.StateFlowImpl.updateState(StateFlow.kt:345)
       at kotlinx.coroutines.flow.StateFlowImpl.setValue(StateFlow.kt:312)
       at io.getstream.chat.android.client.setup.state.internal.MutableClientState.setUser(MutableClientState.kt:95)
       at io.getstream.chat.android.client.ChatClient.handleEvent(ChatClient.kt:440)
       at io.getstream.chat.android.client.ChatClient.access$getEventMutex$p(ChatClient.kt)
       at io.getstream.chat.android.client.ChatClient.access$handleEvent(ChatClient.kt)
       at io.getstream.chat.android.client.ChatClient$1.onEvent(ChatClient.kt:372)
       at io.getstream.chat.android.client.utils.observable.SuspendSubscription$onNext$2.invokeSuspend(Subscriptions.kt:84)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt)

SDK version

  • 6.0.14

To Reproduce No idea. Crash reported from Firebase.

Expected behavior

Device: image

Screenshots None.

donlan avatar Mar 11 '24 09:03 donlan

Hello @donlan This error comes from the Kotlinx Coroutines Library. Digging on their repository, they already have an opened issue related to it, and looks like the root cause is on the Android Runtime code, mainly on Android 12, 13 and 14 :( There is an issue on the Android Issues Tracker as well.

JcMinarro avatar Mar 11 '24 14:03 JcMinarro