diff options
author | Taiju Tsuiki <tzik@google.com> | 2015-04-28 13:36:15 +0900 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2015-04-28 09:30:19 +0100 |
commit | ecd21848731f55978cdac739e6d4460a83449202 (patch) | |
tree | 6ca084d3a64c5c0e5c26b6323512e0358baaabf0 | |
parent | b736868be917afd5d3ea7e8a8d3d658c4350a239 (diff) | |
download | base-ecd21848731f55978cdac739e6d4460a83449202.tar.gz |
Fix NPE in Bundle#hasFileDescriptor on null-valued SparseArray
Add a null check for each values of SparseArray in Bundle#hasFileDescriptor
to avoid NullPointerException.
Change-Id: I43ecc01f2759ccbe85b902fa118d55cb74ebf38b
-rw-r--r-- | core/java/android/os/Bundle.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java index 133debb65ec1..cb3e22be915b 100644 --- a/core/java/android/os/Bundle.java +++ b/core/java/android/os/Bundle.java @@ -222,7 +222,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { SparseArray<? extends Parcelable> array = (SparseArray<? extends Parcelable>) obj; for (int n = array.size() - 1; n >= 0; n--) { - if ((array.valueAt(n).describeContents() + Parcelable p = array.valueAt(n); + if (p != null && (p.describeContents() & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0) { fdFound = true; break; |