diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-07-08 16:40:32 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-07-10 15:18:52 -0700 |
commit | cefd46f86fb276a831a2343fd657f3178b91b76c (patch) | |
tree | 6bf387074718c56fe2506c5fa6deb5e157a1c24c | |
parent | 110185c2184156b3b4f3ef9f1a7c02e5c6eb5c7c (diff) | |
download | android_packages_apps_Trebuchet-cefd46f86fb276a831a2343fd657f3178b91b76c.tar.gz android_packages_apps_Trebuchet-cefd46f86fb276a831a2343fd657f3178b91b76c.tar.bz2 android_packages_apps_Trebuchet-cefd46f86fb276a831a2343fd657f3178b91b76c.zip |
FocusHelper: handle NPE with when getting workspace child
Change-Id: I1955f4ea83f260272b29e93bf3346ed642f4ae95
(cherry picked from commit 1ac777c42e5eb9f17337a55b66e741d0272ac641)
-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(); + } } } } |