From c5aa56da9a3e3247fcc54a2e585bbe30db2f55fb Mon Sep 17 00:00:00 2001 From: Romain Guy <> Date: Tue, 24 Mar 2009 20:42:40 -0700 Subject: [PATCH] Automated import from //branches/donutburger/...@141664,141664 --- src/com/android/launcher/LiveFolder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher/LiveFolder.java b/src/com/android/launcher/LiveFolder.java index 5d727f830d..44a283e094 100644 --- a/src/com/android/launcher/LiveFolder.java +++ b/src/com/android/launcher/LiveFolder.java @@ -90,7 +90,13 @@ public class LiveFolder extends Folder { if (mLoadingTask != null && mLoadingTask.getStatus() == AsyncTask.Status.RUNNING) { mLoadingTask.cancel(true); } - ((LiveFolderAdapter) mContent.getAdapter()).cleanup(); + + // The adapter can be null if onClose() is called before FolderLoadingTask + // is done querying the provider + final LiveFolderAdapter adapter = (LiveFolderAdapter) mContent.getAdapter(); + if (adapter != null) { + adapter.cleanup(); + } } static class FolderLoadingTask extends AsyncTask {