diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-07-08 16:40:32 -0700 |
---|---|---|
committer | Rajesh Yengisetty <rajesh@cyngn.com> | 2015-07-09 10:54:28 -0700 |
commit | 1ac777c42e5eb9f17337a55b66e741d0272ac641 (patch) | |
tree | d16e3e11e1dd5911b3569d3101dc879614cceec2 /src/com/android/launcher3/FocusHelper.java | |
parent | aa2cb4a5978a2e37abfd9611a1241de1c4553d78 (diff) | |
download | packages_apps_Trebuchet-1ac777c42e5eb9f17337a55b66e741d0272ac641.tar.gz packages_apps_Trebuchet-1ac777c42e5eb9f17337a55b66e741d0272ac641.tar.bz2 packages_apps_Trebuchet-1ac777c42e5eb9f17337a55b66e741d0272ac641.zip |
FocusHelper: handle NPE with when getting workspace child
Change-Id: I1955f4ea83f260272b29e93bf3346ed642f4ae95
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r-- | src/com/android/launcher3/FocusHelper.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index d529b3901..d4a908f64 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -492,14 +492,18 @@ public class FocusHelper { if (workspace != null) { int pageIndex = workspace.getCurrentPage(); CellLayout topLayout = (CellLayout) workspace.getChildAt(pageIndex); - ShortcutAndWidgetContainer children = topLayout.getShortcutsAndWidgets(); - final View newIcon = getIconInDirection(layout, children, -1, 1); - // Select the first bubble text view in the current page of the workspace - if (newIcon != null) { - newIcon.requestFocus(); - v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP); - } else { - workspace.requestFocus(); + ShortcutAndWidgetContainer children = topLayout != null ? + topLayout.getShortcutsAndWidgets() : null; + if (children != null) { + final View newIcon = getIconInDirection(layout, children, -1, 1); + // Select the first bubble text view in the current page of the + // workspace + if (newIcon != null) { + newIcon.requestFocus(); + v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP); + } else { + workspace.requestFocus(); + } } } } |