From ee0ce2b29f9cb06cc143c6f30ffc77f4915b0da9 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Tue, 2 Jul 2013 17:24:35 -0700 Subject: [PATCH] Fix NPE when drags are cancelled --- src/com/android/launcher3/Workspace.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 9ee69be22b..16c52ded5a 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -499,9 +499,9 @@ public class Workspace extends SmoothPagedView CellLayout newScreen = (CellLayout) mLauncher.getLayoutInflater().inflate(R.layout.workspace_screen, null); - addView(newScreen, getChildCount()); mWorkspaceScreens.put(screenId, newScreen); mScreenOrder.add(screenId); + addView(newScreen, getChildCount()); if (updateDb) { // On bind we don't need to update the screens in the database. mLauncher.getModel().updateWorkspaceScreenOrder(mLauncher, mScreenOrder); @@ -525,10 +525,10 @@ public class Workspace extends SmoothPagedView AppWidgetHostView.getDefaultPaddingForWidget(mLauncher, mLauncher.getComponentName(), p); customContent.setPadding(p.left, p.top, p.right, p.bottom); - addView(customScreen, 0); - mWorkspaceScreens.put(CUSTOM_CONTENT_SCREEN_ID, customScreen); mScreenOrder.add(0, CUSTOM_CONTENT_SCREEN_ID); + addView(customScreen, 0); + // Ensure that the current page and default page are maintained. mDefaultPage++;