diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2015-03-14 02:25:42 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-03-14 02:25:42 -0700 |
| commit | 0d24552f5a586cf6e5bf697b3db68a7bf550805e (patch) | |
| tree | 19c5a96332447fc2c680272607f535b33c6a35ff | |
| parent | b5b4b3844d18f05fc7a48f87e4de15566ab573b4 (diff) | |
| parent | 76a394545eb1ff6149e8e49ddfff452d367a9200 (diff) | |
| download | packages_apps_ContactsCommon-0d24552f5a586cf6e5bf697b3db68a7bf550805e.tar.gz packages_apps_ContactsCommon-0d24552f5a586cf6e5bf697b3db68a7bf550805e.tar.bz2 packages_apps_ContactsCommon-0d24552f5a586cf6e5bf697b3db68a7bf550805e.zip | |
Merge "Fix NPE in getKindTypeColumn"
| -rw-r--r-- | src/com/android/contacts/common/model/dataitem/EventDataItem.java | 7 | ||||
| -rw-r--r-- | src/com/android/contacts/common/model/dataitem/RelationDataItem.java | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/contacts/common/model/dataitem/EventDataItem.java b/src/com/android/contacts/common/model/dataitem/EventDataItem.java index aae00e97..5096fea2 100644 --- a/src/com/android/contacts/common/model/dataitem/EventDataItem.java +++ b/src/com/android/contacts/common/model/dataitem/EventDataItem.java @@ -20,6 +20,7 @@ import android.content.ContentValues; import android.content.Context; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Event; +import android.text.TextUtils; /** * Represents an event data item, wrapping the columns in @@ -46,12 +47,14 @@ public class EventDataItem extends DataItem { } final EventDataItem that = (EventDataItem) t; // Events can be different (anniversary, birthday) but have the same start date - if (!getStartDate().equals(that.getStartDate())) { + if (!TextUtils.equals(getStartDate(), that.getStartDate())) { return false; + } else if (!hasKindTypeColumn(mKind) || !that.hasKindTypeColumn(that.getDataKind())) { + return hasKindTypeColumn(mKind) == that.hasKindTypeColumn(that.getDataKind()); } else if (getKindTypeColumn(mKind) != that.getKindTypeColumn(that.getDataKind())) { return false; } else if (getKindTypeColumn(mKind) == Event.TYPE_CUSTOM && - !getLabel().equals(that.getLabel())) { + !TextUtils.equals(getLabel(), that.getLabel())) { // Check if custom types are not the same return false; } diff --git a/src/com/android/contacts/common/model/dataitem/RelationDataItem.java b/src/com/android/contacts/common/model/dataitem/RelationDataItem.java index 1ba3fcfb..9e883fef 100644 --- a/src/com/android/contacts/common/model/dataitem/RelationDataItem.java +++ b/src/com/android/contacts/common/model/dataitem/RelationDataItem.java @@ -20,6 +20,7 @@ import android.content.ContentValues; import android.content.Context; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Relation; +import android.text.TextUtils; /** * Represents a relation data item, wrapping the columns in @@ -46,12 +47,14 @@ public class RelationDataItem extends DataItem { } final RelationDataItem that = (RelationDataItem) t; // Relations can have different types (assistant, father) but have the same name - if (!getName().equals(that.getName())) { + if (!TextUtils.equals(getName(), that.getName())) { return false; + } else if (!hasKindTypeColumn(mKind) || !that.hasKindTypeColumn(that.getDataKind())) { + return hasKindTypeColumn(mKind) == that.hasKindTypeColumn(that.getDataKind()); } else if (getKindTypeColumn(mKind) != that.getKindTypeColumn(that.getDataKind())) { return false; } else if (getKindTypeColumn(mKind) == Relation.TYPE_CUSTOM && - !getLabel().equals(that.getLabel())) { + !TextUtils.equals(getLabel(), that.getLabel())) { // Check if custom types are not the same return false; } |
