diff options
| author | 2015-04-22 16:59:00 +0900 | |
|---|---|---|
| committer | 2015-04-28 09:27:40 +0100 | |
| commit | e58c7858a39d58a222fe8302dc5ffbe4a25c5bf1 (patch) | |
| tree | 3eb4ecf140058ea5592cad3b4f745750d69a52cb | |
| parent | c29791d56abbbbaef9786f5d25ecc6c32975bd9f (diff) | |
Fix NullPointerException in Bundle#hasFileDescriptors
Add null check for array elements in Bundle#hasFileDescriptors to avoid NPE on
null valued array.
Change-Id: Ic6ef8864ca6add023c7a69ba3c9474b0f6291723
| -rw-r--r-- | core/java/android/os/Bundle.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java index c5c537263bbd..133debb65ec1 100644 --- a/core/java/android/os/Bundle.java +++ b/core/java/android/os/Bundle.java @@ -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; } |