summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-07-22 09:52:37 -0700
committerSunny Goyal <sunnygoyal@google.com>2014-07-22 12:04:22 -0700
commit25611b181f19a302fc6fa1aa1489ee1585c11316 (patch)
tree3d6665fd111d393cc48039d10503c926d679a6be
parent82cc3fe6c77322d93ff74b25354e4bca77ab4a83 (diff)
downloadandroid_packages_apps_Trebuchet-25611b181f19a302fc6fa1aa1489ee1585c11316.tar.gz
android_packages_apps_Trebuchet-25611b181f19a302fc6fa1aa1489ee1585c11316.tar.bz2
android_packages_apps_Trebuchet-25611b181f19a302fc6fa1aa1489ee1585c11316.zip
Adding nulls check in various drop-drop events
The original patch by motorola had another check, but the 2nd check is wrong as in that case, there would be a nullpointer exception just after the check for the same reason. issue: 15518908 issue: 15516428 Change-Id: I85c5fb3541b7f837e6c5295e97e45162a4120e39
-rw-r--r--src/com/android/launcher3/Workspace.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 267dde800..58987cdf3 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3102,7 +3102,12 @@ public class Workspace extends SmoothPagedView
final ItemInfo info = (ItemInfo) cell.getTag();
if (hasMovedLayouts) {
// Reparent the view
- getParentCellLayoutForView(cell).removeView(cell);
+ CellLayout parentCell = getParentCellLayoutForView(cell);
+ if (parentCell != null) {
+ parentCell.removeView(cell);
+ } else if (LauncherAppState.isDogfoodBuild()) {
+ throw new NullPointerException("mDragInfo.cell has null parent");
+ }
addInScreen(cell, container, screenId, mTargetCell[0], mTargetCell[1],
info.spanX, info.spanY);
}
@@ -3561,6 +3566,12 @@ public class Workspace extends SmoothPagedView
Rect r = new Rect();
CellLayout layout = null;
ItemInfo item = (ItemInfo) d.dragInfo;
+ if (item == null) {
+ if (LauncherAppState.isDogfoodBuild()) {
+ throw new NullPointerException("DragObject has null info");
+ }
+ return;
+ }
// Ensure that we have proper spans for the item that we are dropping
if (item.spanX < 0 || item.spanY < 0) throw new RuntimeException("Improper spans found");
@@ -4188,6 +4199,8 @@ public class Workspace extends SmoothPagedView
CellLayout parentCell = getParentCellLayoutForView(mDragInfo.cell);
if (parentCell != null) {
parentCell.removeView(mDragInfo.cell);
+ } else if (LauncherAppState.isDogfoodBuild()) {
+ throw new NullPointerException("mDragInfo.cell has null parent");
}
if (mDragInfo.cell instanceof DropTarget) {
mDragController.removeDropTarget((DropTarget) mDragInfo.cell);