eowise / recyclerview-stickyheaders

DEPRECATED. Android library that integrate sticky section headers in your RecyclerView
http://eowise.github.io/recyclerview-stickyheaders
MIT License
961 stars 148 forks source link

IndexOutOfBoundsException in HeaderStore #39

Closed MichaelRocks closed 9 years ago

MichaelRocks commented 9 years ago

I constantly get the following exception when RecyclerView's adapter calls notifyItemChanged() for an item that has never been shown. It seems to me that HeaderStore.onItemRangeChanged() shouldn't handle this event for items with position larger than isHeaderByItemPosition.size().

    java.lang.IndexOutOfBoundsException: Invalid index 81, size is 6
            at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
            at java.util.ArrayList.set(ArrayList.java:481)
            at com.eowise.recyclerview.stickyheaders.HeaderStore.onItemRangeChanged(HeaderStore.java:219)
            at com.eowise.recyclerview.stickyheaders.StickyHeadersItemDecoration$AdapterDataObserver.onItemRangeChanged(StickyHeadersItemDecoration.java:140)
            at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:7503)
            at android.support.v7.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java:4353)
            ...