ca-love / lounge

Lounge is an Android library for building Leanback user interface required by Android TV.
https://ca-love.github.io/lounge/
MIT License
12 stars 1 forks source link

PagedListLoungeController: Attempt to invoke interface method 'long com.cllive.lounge.LoungeModel.getKey()' on a null object reference #13

Closed lcdsmao closed 3 years ago

lcdsmao commented 3 years ago

🐛 Describe the bug

2020-12-18 16:23:41.138 32475-32475/com.cllive E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.cllive, PID: 32475
    java.lang.NullPointerException: Attempt to invoke interface method 'long com.cllive.lounge.LoungeModel.getKey()' on a null object reference
        at com.cllive.lounge.LoungeController.verifyModel(LoungeController.kt:259)
        at com.cllive.lounge.LoungeController.unaryPlus(LoungeController.kt:127)
        at com.cllive.lounge.LoungeController.unaryPlus(LoungeController.kt:136)
        at com.cllive.lounge.paging.PagedListRowModelKt$pagedListRowFor$3.invokeSuspend(PagedListRowModel.kt:127)
        at com.cllive.lounge.paging.PagedListRowModelKt$pagedListRowFor$3.invoke(PagedListRowModel.kt)
        at com.cllive.lounge.paging.LambdaPagedListLoungeController.buildModels(LambdaPagedListLoungeController.kt:27)
        at com.cllive.lounge.LoungeController$collectModelBuildRequest$2.invokeSuspend(LoungeController.kt:224)
        at com.cllive.lounge.LoungeController$collectModelBuildRequest$2.invoke(LoungeController.kt)
        at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:214)
        at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Merge.kt)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$invokeSuspend$$inlined$collect$1$lambda$1.invokeSuspend(Merge.kt:34)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$invokeSuspend$$inlined$collect$1$lambda$1.invoke(Merge.kt)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
        at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
        at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:49)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$invokeSuspend$$inlined$collect$1.emit(Collect.kt:138)
        at kotlinx.coroutines.flow.SharedFlowImpl.collect(SharedFlow.kt:341)
        at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(SharedFlow.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6194)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:801)

Occurs when currentList.size != modelCache.size

⚠️ Current behavior

✅ Expected behavior

💣 Steps to reproduce

📷 Screenshots

📱 Tech info