Merge "Fix NPE of FolderPagedView#setFocusOnFirstChild" into udc-dev am: 0d07a85299

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23254588

Change-Id: Iaa4e6bc87de4f08486ee28e8daf28b809778d01a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index 6ff8ece..26a1886 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -46,7 +46,6 @@
 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 @@
      * 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