diff options
| author | Danny Baumann <dannybaumann@web.de> | 2015-11-14 14:17:18 +0100 |
|---|---|---|
| committer | Rohit Yengisetty <rohit@cyngn.com> | 2015-11-18 11:09:54 -0800 |
| commit | 2232b0e579c447678ad81de36d6275eecc6cdd43 (patch) | |
| tree | 3038994ca9ec2f8664c49dcef19e24186e38040b /src/com/android | |
| parent | 9c990c3a0ebd44f0ecd32b29f2b943092a6256b9 (diff) | |
| download | android_packages_apps_ContactsCommon-2232b0e579c447678ad81de36d6275eecc6cdd43.tar.gz android_packages_apps_ContactsCommon-2232b0e579c447678ad81de36d6275eecc6cdd43.tar.bz2 android_packages_apps_ContactsCommon-2232b0e579c447678ad81de36d6275eecc6cdd43.zip | |
Fix contact JSON record parsing.
Change-Id: I6c40ad9636a1be3662261bf8a364b3a52c624598
Diffstat (limited to 'src/com/android')
| -rw-r--r-- | src/com/android/contacts/common/model/ContactLoader.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/contacts/common/model/ContactLoader.java b/src/com/android/contacts/common/model/ContactLoader.java index 1078e836..ee1ddd1c 100644 --- a/src/com/android/contacts/common/model/ContactLoader.java +++ b/src/com/android/contacts/common/model/ContactLoader.java @@ -449,17 +449,18 @@ public class ContactLoader extends AsyncTaskLoader<Contact> { // Could be single object, int, or array. JSONObject obj = items.optJSONObject(mimetype); final int num = items.optInt(mimetype, -1); - if (obj == null && num != -1) { + if (obj == null && num == -1) { + // Neither object nor int, thus must be array final JSONArray array = items.getJSONArray(mimetype); for (int i = 0; i < array.length(); i++) { final JSONObject item = array.getJSONObject(i); processOneRecord(rawContact, item, mimetype); } - } else if (num != -1 && obj != null) { + } else if (num != -1) { obj = new JSONObject(); obj.put(mimetype, num); processOneRecord(rawContact, obj, mimetype); - } else { + } else if (obj != null) { processOneRecord(rawContact, obj, mimetype); } } |
