diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 2e38743b95b72..7631df49e6bb3 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -4106,8 +4106,7 @@ public abstract class AbsListView extends AdapterView implements Te final int topLimit = getPaddingTop(); final int bottomLimit = getHeight() - getPaddingBottom(); - if (distance == 0 || - firstPos == INVALID_POSITION || + if (distance == 0 || mItemCount == 0 || childCount == 0 || (firstPos == 0 && getChildAt(0).getTop() == topLimit && distance < 0) || (lastPos == mItemCount - 1 && getChildAt(childCount - 1).getBottom() == bottomLimit && distance > 0)) {