mirror of
https://github.com/leaf-wai/StackLayoutManager.git
synced 2026-07-12 10:51:17 +08:00
Fix crash if adapter is empty.
"java.lang.IndexOutOfBoundsException: Invalid item position -1(-1). Item count:0"
This commit is contained in:
@@ -278,6 +278,10 @@ class StackLayoutManager(scrollOrientation: ScrollOrientation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onLayoutChildren(recycler: RecyclerView.Recycler, state: RecyclerView.State) {
|
override fun onLayoutChildren(recycler: RecyclerView.Recycler, state: RecyclerView.State) {
|
||||||
|
if (itemCount == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
mLayout?.requestLayout()
|
mLayout?.requestLayout()
|
||||||
|
|
||||||
removeAndRecycleAllViews(recycler)
|
removeAndRecycleAllViews(recycler)
|
||||||
|
|||||||
Reference in New Issue
Block a user