epoxy: IndexOutOfBoundsException in EpoxyModelGroup binding
Hi,
We use EpoxyModelGroup
in our app and since then it crash on IndexOutOfBoundsException
(see stack-trace below). Unfortunately I cannot publish our code but I will try to repro in a sample app. The crash happen when a model group get updated and when the nested models increase.
It crash on this line in EpoxyModelGroup.java
EpoxyModel<?> previousModel = previousGroup.models.get(modelIndex);`
Before they were 4 models in the group and after the update there were 11 models.
java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
at java.util.ArrayList.get(ArrayList.java:437)
at com.airbnb.epoxy.EpoxyModelGroup$3.onModel(EpoxyModelGroup.java:144)
at com.airbnb.epoxy.EpoxyModelGroup.iterateModels(EpoxyModelGroup.java:197)
at com.airbnb.epoxy.EpoxyModelGroup.bind(EpoxyModelGroup.java:139)
at com.airbnb.epoxy.EpoxyViewHolder.bind(EpoxyViewHolder.java:57)
at com.airbnb.epoxy.BaseEpoxyAdapter.onBindViewHolder(BaseEpoxyAdapter.java:97)
at com.airbnb.epoxy.EpoxyControllerAdapter.onBindViewHolder(EpoxyControllerAdapter.java:16)
at com.airbnb.epoxy.BaseEpoxyAdapter.onBindViewHolder(BaseEpoxyAdapter.java:15)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194)
Using Epoxy 3.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (11 by maintainers)
Hm not sure if the fix affects everything. Because I am able to reproduce a similiar error with 3.3.0 without using ModelGroups 😕
It happens when scrolling too fast