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
This commit is contained in:
committed by
Narayan Kamath
parent
b736868be9
commit
ecd2184873
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user