OSDN Git Service

Fix NPE in Workspace.onDropCompleted
authorJorim Jaggi <jjaggi@google.com>
Mon, 13 Jan 2014 21:45:07 +0000 (13:45 -0800)
committerJorim Jaggi <jjaggi@google.com>
Tue, 14 Jan 2014 21:02:43 +0000 (13:02 -0800)
Bug: 11627757
Change-Id: I9dc86856d4bc00253d6350d157be541a8c46888d

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

index 5e41fca..5cfcf8b 100644 (file)
@@ -238,4 +238,8 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
         return getInstance().mBuildInfo.isDogfoodBuild() &&
                 Launcher.isPropertyEnabled(Launcher.DISABLE_ALL_APPS_PROPERTY);
     }
+
+    public static boolean isDogfoodBuild() {
+        return getInstance().mBuildInfo.isDogfoodBuild();
+    }
 }
index b6276c0..91c29cb 100644 (file)
@@ -4051,7 +4051,13 @@ public class Workspace extends SmoothPagedView
             } else {
                 cellLayout = getScreenWithId(mDragInfo.screenId);
             }
-            cellLayout.onDropChild(mDragInfo.cell);
+            if (cellLayout == null && LauncherAppState.isDogfoodBuild()) {
+                throw new RuntimeException("Invalid state: cellLayout == null in "
+                        + "Workspace#onDropCompleted. Please file a bug. ");
+            }
+            if (cellLayout != null) {
+                cellLayout.onDropChild(mDragInfo.cell);
+            }
         }
         if ((d.cancelled || (beingCalledAfterUninstall && !mUninstallSuccessful))
                 && mDragInfo.cell != null) {