Fix 4020235: NPE at com.android.launcher2.DragLayer.onInterceptTouchEvent
Change-Id: I606573f36270109b156b625b416d05ee16a44316
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 2e72f62..eb53945 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -62,17 +62,19 @@
// event has occurred which doesn't result in resizing a widget. In this case, we
// dismiss any visible resize frames.
final Workspace w = (Workspace) findViewById(R.id.workspace);
- final CellLayout currentPage = (CellLayout) w.getChildAt(w.getCurrentPage());
- final CellLayoutChildren childrenLayout = currentPage.getChildrenLayout();
+ if (w != null) {
+ final CellLayout currentPage = (CellLayout) w.getChildAt(w.getCurrentPage());
+ final CellLayoutChildren childrenLayout = currentPage.getChildrenLayout();
- if (childrenLayout.hasResizeFrames() && !childrenLayout.isWidgetBeingResized()) {
- post(new Runnable() {
- public void run() {
- if (!childrenLayout.isWidgetBeingResized()) {
- childrenLayout.clearAllResizeFrames();
+ if (childrenLayout.hasResizeFrames() && !childrenLayout.isWidgetBeingResized()) {
+ post(new Runnable() {
+ public void run() {
+ if (!childrenLayout.isWidgetBeingResized()) {
+ childrenLayout.clearAllResizeFrames();
+ }
}
- }
- });
+ });
+ }
}
return mDragController.onInterceptTouchEvent(ev);
}