mirror of
https://github.com/leaf-wai/StackLayoutManager.git
synced 2026-03-26 22:32:50 +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) {
|
||||
if (itemCount == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
mLayout?.requestLayout()
|
||||
|
||||
removeAndRecycleAllViews(recycler)
|
||||
|
||||
Reference in New Issue
Block a user