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

Commit e1bf4868 authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 5201420 - Appease the monkeys

Make ListView.onFocusChanged more tolerant of missing adapters.

Change-Id: Icae1cfd02fe369d3fd0e3c6531adb973f44f3036
parent f7315dd1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3384,11 +3384,11 @@ public class ListView extends AbsListView {
    protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
        super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);

        final ListAdapter adapter = mAdapter;
        int closetChildIndex = -1;
        if (gainFocus && previouslyFocusedRect != null) {
        if (adapter != null && gainFocus && previouslyFocusedRect != null) {
            previouslyFocusedRect.offset(mScrollX, mScrollY);

            final ListAdapter adapter = mAdapter;
            // Don't cache the result of getChildCount or mFirstPosition here,
            // it could change in layoutChildren.
            if (adapter.getCount() < getChildCount() + mFirstPosition) {