Skip to content

Commit 52f7fcf

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "DO NOT MERGE AdapterView#isScrollableForAccessibility does not handle null adapter." into ics-mr0
2 parents c351ab4 + 9834851 commit 52f7fcf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

core/java/android/widget/AdapterView.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,9 +928,13 @@ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
928928
}
929929

930930
private boolean isScrollableForAccessibility() {
931-
final int itemCount = getAdapter().getCount();
932-
return itemCount > 0
933-
&& (getFirstVisiblePosition() > 0 || getLastVisiblePosition() < itemCount - 1);
931+
T adapter = getAdapter();
932+
if (adapter != null) {
933+
final int itemCount = adapter.getCount();
934+
return itemCount > 0
935+
&& (getFirstVisiblePosition() > 0 || getLastVisiblePosition() < itemCount - 1);
936+
}
937+
return false;
934938
}
935939

936940
@Override

0 commit comments

Comments
 (0)