summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI
diff options
context:
space:
mode:
authorShufeng Hou <shou@codeaurora.org>2015-10-26 16:06:07 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-26 19:42:33 -0700
commit5c72c24ba871949e106f329254f46ef3a43e2d40 (patch)
tree667595307be88f9cf1a8ad669483dcab11fb9478 /packages/DocumentsUI
parentbfd172844be92b0ebb87445410de1fa48570dc49 (diff)
downloadframeworks_base-5c72c24ba871949e106f329254f46ef3a43e2d40.zip
frameworks_base-5c72c24ba871949e106f329254f46ef3a43e2d40.tar.gz
frameworks_base-5c72c24ba871949e106f329254f46ef3a43e2d40.tar.bz2
DocumentsUI: Fix NullPointerException in DocumentInfo
Add null pointer check for cursor to avoid crash during stability test. Change-Id: Ia715345365468f1cb10850d21386c9117885fb23 CRs-Fixed: 927937
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index 006f6e9..ffdf0a7 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -527,8 +527,10 @@ public class DirectoryFragment extends Fragment {
for (int i = 0; i < size; i++) {
if (checked.valueAt(i)) {
final Cursor cursor = mAdapter.getItem(checked.keyAt(i));
- final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
- docs.add(doc);
+ if (cursor != null) {
+ final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
+ docs.add(doc);
+ }
}
}