From 2f137b7705875ee026319abb8e512d918c118222 Mon Sep 17 00:00:00 2001 From: Shreyas Basarge Date: Thu, 12 Nov 2015 15:32:44 +0000 Subject: [PATCH] Sync extras bundle comparison can throw NPE Bug: 23591205 Change-Id: I960dfcc1584c0a17685790d5d722eaf11b930e25 --- core/java/android/content/PeriodicSync.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/java/android/content/PeriodicSync.java b/core/java/android/content/PeriodicSync.java index b586eec76748b..e27870f967862 100644 --- a/core/java/android/content/PeriodicSync.java +++ b/core/java/android/content/PeriodicSync.java @@ -21,6 +21,8 @@ import android.os.Bundle; import android.os.Parcel; import android.accounts.Account; +import java.util.Objects; + /** * Value type that contains information about a periodic sync. */ @@ -147,7 +149,9 @@ public class PeriodicSync implements Parcelable { if (!b2.containsKey(key)) { return false; } - if (!b1.get(key).equals(b2.get(key))) { + // Null check. According to ContentResolver#validateSyncExtrasBundle null-valued keys + // are allowed in the bundle. + if (!Objects.equals(b1.get(key), b2.get(key))) { return false; } }