From 729b5ca9baa21f81ec5f3498e49cfcb275dbe52a Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 26 Mar 2010 17:49:15 -0700 Subject: [PATCH] Handle case of typed data with a null type * There's an NPE if we downsync a contact containing a piece of typed data for which there is no type specified in the database * Check for this and accept "no type" as a match Bug: 2539843 Change-Id: I155b635a1f9850af9813681f502f3565c3cfcd4b --- src/com/android/exchange/adapter/ContactsSyncAdapter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/exchange/adapter/ContactsSyncAdapter.java b/src/com/android/exchange/adapter/ContactsSyncAdapter.java index ccfaa32ca..2fe5d7e9d 100644 --- a/src/com/android/exchange/adapter/ContactsSyncAdapter.java +++ b/src/com/android/exchange/adapter/ContactsSyncAdapter.java @@ -1017,7 +1017,10 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { } // Note Email.TYPE could be ANY type column; they are all defined in // the private CommonColumns class in ContactsContract - } else if (type < 0 || cv.getAsInteger(Email.TYPE) == type) { + // We'll accept either type < 0 (don't care), cv doesn't have a type, + // or the types are equal + } else if (type < 0 || !cv.containsKey(Email.TYPE) || + cv.getAsInteger(Email.TYPE) == type) { result = namedContentValues; } }