Check isDestroyed after finishing async HandleRootsChangedTask.
HandleRootsChangedTask will be finished after the Activity is destroyed,
though we no longer to be able to change the directory at that time.
BUG=26454277
Change-Id: Ia414134c80d900ef2e6c382fdd9209a154d940af
diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java
index 180a48e..2e2dccd 100644
--- a/src/com/android/documentsui/BaseActivity.java
+++ b/src/com/android/documentsui/BaseActivity.java
@@ -630,7 +630,7 @@
@Override
protected void onPostExecute(RootInfo homeRoot) {
- if (homeRoot != null && mHome != null) {
+ if (homeRoot != null && mHome != null && !isDestroyed()) {
// Clear entire backstack and start in new root
mState.onRootChanged(homeRoot);
mSearchManager.update(homeRoot);