From d94533d04a5f8f5485f106d10af60169857ea899 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 17 Aug 2009 10:01:15 -0700 Subject: [PATCH] Fix possible NPE in Launcher. --- src/com/android/launcher2/CellLayout.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 2f094034d9..b8d44a1504 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -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) {