Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54669f83 authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

AdapterView#isScrollableForAccessibility does not handle null adapter.

1. If an AdapterView has no adapter and the view tries to fire an
   accessibility event we get a null pointer exception.

bug:5439321

Change-Id: Ia3d7a5ad852ef42422d10d8a62c4d3af6792313b
parent 041ed048
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -928,10 +928,14 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
    }

    private boolean isScrollableForAccessibility() {
        final int itemCount = getAdapter().getCount();
        T adapter = getAdapter();
        if (adapter != null) {
            final int itemCount = adapter.getCount();
            return itemCount > 0
                && (getFirstVisiblePosition() > 0 || getLastVisiblePosition() < itemCount - 1);
        }
        return false;
    }

    @Override
    protected boolean canAnimate() {