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

notifyItemChanged causes ArrayIndexOutOfBoundsException #32

Closed robbypond closed 9 years ago

robbypond commented 9 years ago

Modifying an Adapter item and calling notifyItemChanged causes an ArrayIndexOutOfBoundsException. The stacktrace is below. This pull request adds an edit (by long click) capability that can reproduce the issue.

Caused by: java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1 at java.util.ArrayList.set(ArrayList.java:483) 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)

leruaa commented 9 years ago

Thanks for the PR. I will see how to resolve this.