am 3cd030a4: Merge "Don\'t pass a null View to OnListItemClickListener. Bug #3365153" into honeycomb

* commit '3cd030a4fe229155b252cee003c78e2467ff4d82':
  Don't pass a null View to OnListItemClickListener. Bug #3365153
This commit is contained in:
Romain Guy
2011-01-18 20:29:30 -08:00
committed by Android Git Automerger

View File

@@ -2439,8 +2439,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
if (adapter != null && mItemCount > 0 &&
motionPosition != INVALID_POSITION &&
motionPosition < adapter.getCount() && sameWindow()) {
performItemClick(getChildAt(motionPosition - mFirstPosition), motionPosition,
adapter.getItemId(motionPosition));
final View view = getChildAt(motionPosition - mFirstPosition);
// If there is no view, something bad happened (the view scrolled off the
// screen, etc.) and we should cancel the click
if (view != null) {
performItemClick(view, motionPosition, adapter.getItemId(motionPosition));
}
}
}
}