From 944491587e8a8f77233a1916cc16cd07edd97f2e Mon Sep 17 00:00:00 2001 From: Ian Parkinson Date: Tue, 21 Jan 2014 13:09:59 +0000 Subject: Avoid NPE from delayed Runnable Naive fix to b/12656485. Other Runnables in Launcher similarly check that mWorkspace hasn't become null between being posted and being executed, so I think this is probably appropriate. Bug: 12656485 Change-Id: Ib4f3d0e8686c6249fe838144b1e8120c85f66f01 --- src/com/android/launcher3/Launcher.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 9a16037ae..50bbe51a5 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3951,9 +3951,11 @@ public class Launcher extends Activity // when we are loading right after we return to launcher. mWorkspace.postDelayed(new Runnable() { public void run() { - mWorkspace.snapToPage(newScreenIndex); - mWorkspace.postDelayed(startBounceAnimRunnable, - NEW_APPS_ANIMATION_DELAY); + if (mWorkspace != null) { + mWorkspace.snapToPage(newScreenIndex); + mWorkspace.postDelayed(startBounceAnimRunnable, + NEW_APPS_ANIMATION_DELAY); + } } }, NEW_APPS_PAGE_MOVE_DELAY); } else { -- cgit v1.2.3