Fix NullPointerException in Bundle#hasFileDescriptors

Add null check for array elements in Bundle#hasFileDescriptors to avoid NPE on
null valued array.

Change-Id: Ic6ef8864ca6add023c7a69ba3c9474b0f6291723
This commit is contained in:
Taiju Tsuiki
2015-04-22 16:59:00 +09:00
committed by Narayan Kamath
parent c29791d56a
commit e58c7858a3

View File

@@ -211,8 +211,9 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
} else if (obj instanceof Parcelable[]) {
Parcelable[] array = (Parcelable[]) obj;
for (int n = array.length - 1; n >= 0; n--) {
if ((array[n].describeContents()
& Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0) {
Parcelable p = array[n];
if (p != null && ((p.describeContents()
& Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0)) {
fdFound = true;
break;
}