diff options
author | Fengjiang Li <fengjial@google.com> | 2023-05-15 21:51:10 -0700 |
---|---|---|
committer | Fengjiang Li <fengjial@google.com> | 2023-05-15 21:52:19 -0700 |
commit | 47d72ffccb759bb4d6b2aec9a706ff8517ded50f (patch) | |
tree | 05821e3802fa8a6683c6242de1e41a6cc70cd76f /src | |
parent | d382a4880b2afb22d23fbcbbb0a643c5a1b1f168 (diff) | |
download | Launcher3-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.java | 12 |
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 |