Skip to content

Commit 0e6fa8b

Browse files
committed
AdapterView does not check for null adapter when initializing accessibility event.
The code that initializes accessibility events was assuming the AdapterView always has an adapter and this caused NPE. Now the right method of the view is called to get the item count. bug:5474162 Change-Id: I6c330dc2894477df9447a4ecfddc7bd62c575d59
1 parent 47f8367 commit 0e6fa8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/java/android/widget/AdapterView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
925925
event.setCurrentItemIndex(getSelectedItemPosition());
926926
event.setFromIndex(getFirstVisiblePosition());
927927
event.setToIndex(getLastVisiblePosition());
928-
event.setItemCount(getAdapter().getCount());
928+
event.setItemCount(getCount());
929929
}
930930

931931
private boolean isScrollableForAccessibility() {

0 commit comments

Comments
 (0)