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

Commit 47d72ffc authored by Fengjiang Li's avatar Fengjiang Li
Browse files

Fix NPE of FolderPagedView#setFocusOnFirstChild

Test: open and close folder with swipe back quickly
Fix: 282814528
Change-Id: I163c2f9d54b48684738f8104be8c085f26b52ceb
parent d382a488
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pageindicators.PageIndicatorDots;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.util.LauncherBindableItemsContainer.ItemOperator;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.ViewCache;
@@ -421,10 +420,15 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
     * Sets the focus on the first visible child.
     */
    public void setFocusOnFirstChild() {
        View firstChild = getCurrentCellLayout().getChildAt(0, 0);
        if (firstChild != null) {
            firstChild.requestFocus();
        CellLayout currentCellLayout = getCurrentCellLayout();
        if (currentCellLayout == null) {
            return;
        }
        View firstChild = currentCellLayout.getChildAt(0, 0);
        if (firstChild == null) {
            return;
        }
        firstChild.requestFocus();
    }

    @Override