OSDN Git Service

Add guards for restoreInstanceState (issue 11982812)
authorAdam Cohen <adamcohen@google.com>
Tue, 3 Dec 2013 18:51:45 +0000 (10:51 -0800)
committerAdam Cohen <adamcohen@google.com>
Tue, 3 Dec 2013 18:52:21 +0000 (10:52 -0800)
Change-Id: Ic4c632a956130ab28843085490dc1badb39b0e8c

src/com/android/launcher3/LauncherModel.java
src/com/android/launcher3/Workspace.java

index 4d9dff9..74f28b3 100644 (file)
@@ -2298,7 +2298,7 @@ public class LauncherModel extends BroadcastReceiver {
                 r = new Runnable() {
                     public void run() {
                         Callbacks callbacks = tryGetCallbacks(oldCallbacks);
-                        if (callbacks != null) {
+                        if (callbacks != null && currentScreen >= 0) {
                             callbacks.onPageBoundSynchronously(currentScreen);
                         }
                     }
index 3b7afc7..c6c6e13 100644 (file)
@@ -4254,7 +4254,9 @@ public class Workspace extends SmoothPagedView
         if (mSavedStates != null) {
             mRestoredPages.add(child);
             CellLayout cl = (CellLayout) getChildAt(child);
-            cl.restoreInstanceState(mSavedStates);
+            if (cl != null) {
+                cl.restoreInstanceState(mSavedStates);
+            }
         }
     }