Skip to content

Commit

Permalink
prevent possible race condition hwere position is no longer valid, wh…
Browse files Browse the repository at this point in the history
…en click handler is run
  • Loading branch information
mtotschnig committed Mar 5, 2016
1 parent dfa1dd5 commit 7c5d2e8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private View configureHeader(WrapperView wv, final int position) {

@Override
public void onClick(View v) {
if(mOnHeaderClickListener != null){
if(mOnHeaderClickListener != null && position < getCount()){
long headerId = mDelegate.getHeaderId(position);
mOnHeaderClickListener.onHeaderClick(v, position, headerId);
}
Expand All @@ -147,7 +147,7 @@ public void onClick(View v) {

@Override
public boolean onLongClick(View v) {
if(mOnHeaderClickListener != null){
if(mOnHeaderClickListener != null && position < getCount()){
long headerId = mDelegate.getHeaderId(position);
return mOnHeaderClickListener.onHeaderLongClick(v, position, headerId);
}
Expand Down

0 comments on commit 7c5d2e8

Please sign in to comment.