summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI
diff options
context:
space:
mode:
authorScott Mertz <scott@cyngn.com>2016-06-13 13:10:38 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-06-17 08:14:00 -0700
commite843aafde27bff303ffb7ebab4595f1ec7a06909 (patch)
treed587feecd8a83483e3e82d0f6c089ef341700f32 /packages/DocumentsUI
parent226797c8e2aba40ecbfb646f2ef5085893dff46a (diff)
downloadframeworks_base-e843aafde27bff303ffb7ebab4595f1ec7a06909.zip
frameworks_base-e843aafde27bff303ffb7ebab4595f1ec7a06909.tar.gz
frameworks_base-e843aafde27bff303ffb7ebab4595f1ec7a06909.tar.bz2
Fix NPE in DocumentsUI when rotate UI before format as internal
When the device is rotated, the action bar may not have already been installed (because such installation is done in onCreateOptionsMenu). Protect against this case. 1.Settings->Storage and USB->SD Card Settings->turn the handset to landscape mode->Format as internal storage. 2.Move data to new storage->Tap Move later 01-03 14:06:34.156 7709 7709 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.documentsui.DocumentsToolBar.hasExpandedActionView()' on a null object reference 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at com.android.documentsui.BaseActivity$SearchManager.cancelSearch(BaseActivity.java:758) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at com.android.documentsui.DocumentsActivity.onBackPressed(DocumentsActivity.java:518) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at com.android.documentsui.DirectoryFragment$4$1.run(DirectoryFragment.java:315) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5461) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 01-03 14:06:34.156 7709 7709 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) FEIJ-1160 Change-Id: I7269ff5b9c189fd1fa4d0716b2d4cbc837349dc5
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
index fc46716..a08f375 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
@@ -755,7 +755,7 @@ abstract class BaseActivity extends Activity {
* search currently.
*/
boolean cancelSearch() {
- if (mActionBar.hasExpandedActionView()) {
+ if (mActionBar != null && mActionBar.hasExpandedActionView()) {
mActionBar.collapseActionView();
return true;
}