Skip to content

Commit 3016c1a

Browse files
committed
NullPointerException in AbsListView.focusSearch().
1. One of the loops was using the last visible position as its end boundary as opposed to the child count minus one. bug:6610451 Change-Id: I600545ca3f64d1e982f909f893e5d34570ec5c8b
1 parent a3404be commit 3016c1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/java/android/widget/AbsListView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ public View focusSearch(View focused, int direction) {
13881388
}
13891389
// Try to move focus to the next item.
13901390
final int nextPosition = currentPosition - getFirstVisiblePosition() + 1;
1391-
for (int i = nextPosition; i <= getLastVisiblePosition(); i++) {
1391+
for (int i = nextPosition; i < getChildCount(); i++) {
13921392
View child = getChildAt(i);
13931393
if (child.getVisibility() == View.VISIBLE) {
13941394
return child;

0 commit comments

Comments
 (0)