Fix a crash on spring loading folder/roots.
Change-Id: I6bcbeffb30b237659eed0a0b2eaba0dfc49f7e99
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index b6a0009..0e6ad38 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -1117,7 +1117,12 @@
// When files are selected for dragging, ActionMode is started. This obscures the breadcrumb
// with an ActionBar. In order to make drag and drop to the breadcrumb possible, we first
// end ActionMode so the breadcrumb is visible to the user.
- mActionModeController.finishActionMode();
+ //
+ // mActionModeController is null when dragStarted() is called on spring loaded
+ // folders/roots.
+ if (mActionModeController != null) {
+ mActionModeController.finishActionMode();
+ }
}
void dragStopped(boolean result) {