Merge "Fix NPE in FolderPagedView" into udc-dev am: 6597d5ec3c

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

Change-Id: I0b477b18f9cab7e71ab839ef99a46e453a792611
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 26a1886..36e5e1b 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -31,6 +31,8 @@
 import android.view.View;
 import android.view.ViewDebug;
 
+import androidx.annotation.Nullable;
+
 import com.android.launcher3.AbstractFloatingView;
 import com.android.launcher3.BubbleTextView;
 import com.android.launcher3.CellLayout;
@@ -230,11 +232,13 @@
         return textView;
     }
 
+    @Nullable
     @Override
     public CellLayout getPageAt(int index) {
         return (CellLayout) getChildAt(index);
     }
 
+    @Nullable
     public CellLayout getCurrentCellLayout() {
         return getPageAt(getNextPage());
     }
@@ -381,7 +385,7 @@
     }
 
     private View getViewInCurrentPage(ToIntFunction<ShortcutAndWidgetContainer> rankProvider) {
-        if (getChildCount() < 1) {
+        if (getChildCount() < 1 || getCurrentCellLayout() == null) {
             return null;
         }
         ShortcutAndWidgetContainer container = getCurrentCellLayout().getShortcutsAndWidgets();