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 (cherry picked from commit e843aafd)
Loading
Please register or sign in to comment