summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFengjiang Li <fengjial@google.com>2023-05-15 21:51:10 -0700
committerFengjiang Li <fengjial@google.com>2023-05-15 21:52:19 -0700
commit47d72ffccb759bb4d6b2aec9a706ff8517ded50f (patch)
tree05821e3802fa8a6683c6242de1e41a6cc70cd76f /src
parentd382a4880b2afb22d23fbcbbb0a643c5a1b1f168 (diff)
downloadLauncher3-47d72ffccb759bb4d6b2aec9a706ff8517ded50f.tar.gz
Fix NPE of FolderPagedView#setFocusOnFirstChild
Test: open and close folder with swipe back quickly Fix: 282814528 Change-Id: I163c2f9d54b48684738f8104be8c085f26b52ceb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/folder/FolderPagedView.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index 6ff8ece5d7..26a1886695 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.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