cwac-merge icon indicating copy to clipboard operation
cwac-merge copied to clipboard

throw exception if position is invalid in getView

Open yishai-glide opened this issue 8 years ago • 0 comments

if due to stupidity of programmer the adapter is requesting a view to be displayed in an invalid position i.e. position > getCount() == true the method returns null and passes the issue to other places in the system

In my case, there was a location in which I forgot to call notifyDatasetInvalidated() when the adapter cleared the data and scrolling in the invalid list wold cause an issue in android.widget.HeaderViewListAdapter.isEnabled instead of throwing it in the initial getView.

I suggest adding a validation of position and an exception instead of returning null and letting the system crash.

yishai-glide avatar Dec 09 '15 13:12 yishai-glide