OSDN Git Service

Fix possible NPE in Launcher.
authorRomain Guy <romainguy@android.com>
Mon, 17 Aug 2009 17:01:15 +0000 (10:01 -0700)
committerJoe Onorato <joeo@android.com>
Mon, 21 Sep 2009 19:12:31 +0000 (15:12 -0400)
src/com/android/launcher2/CellLayout.java

index 2f09403..b8d44a1 100644 (file)
@@ -602,13 +602,15 @@ public class CellLayout extends ViewGroup {
      * @param targetXY Destination area to move to
      */
     void onDropChild(View child, int[] targetXY) {
-        LayoutParams lp = (LayoutParams) child.getLayoutParams();
-        lp.cellX = targetXY[0];
-        lp.cellY = targetXY[1];
-        lp.isDragging = false;
-        mDragRect.setEmpty();
-        child.requestLayout();
-        invalidate();
+        if (child != null) {
+            LayoutParams lp = (LayoutParams) child.getLayoutParams();
+            lp.cellX = targetXY[0];
+            lp.cellY = targetXY[1];
+            lp.isDragging = false;
+            mDragRect.setEmpty();
+            child.requestLayout();
+            invalidate();
+        }
     }
 
     void onDropAborted(View child) {