mirror of
https://github.com/etesync/android
synced 2025-02-12 23:52:41 +00:00
avoid NullPointerExceptions when contact data rows with custom types have no LABEL
This commit is contained in:
parent
3af25754c4
commit
d30715f813
@ -212,7 +212,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
number.addType(Contact.PHONE_TYPE_MMS);
|
number.addType(Contact.PHONE_TYPE_MMS);
|
||||||
break;
|
break;
|
||||||
case Phone.TYPE_CUSTOM:
|
case Phone.TYPE_CUSTOM:
|
||||||
number.addType(TelephoneType.get(labelToXName(cursor.getString(1))));
|
String customType = cursor.getString(1);
|
||||||
|
if (customType != null && !customType.isEmpty())
|
||||||
|
number.addType(TelephoneType.get(labelToXName(customType)));
|
||||||
}
|
}
|
||||||
c.getPhoneNumbers().add(number);
|
c.getPhoneNumbers().add(number);
|
||||||
}
|
}
|
||||||
@ -234,7 +236,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
email.addType(Contact.EMAIL_TYPE_MOBILE);
|
email.addType(Contact.EMAIL_TYPE_MOBILE);
|
||||||
break;
|
break;
|
||||||
case Email.TYPE_CUSTOM:
|
case Email.TYPE_CUSTOM:
|
||||||
email.addType(EmailType.get(labelToXName(cursor.getString(2))));
|
String customType = cursor.getString(2);
|
||||||
|
if (customType != null && !customType.isEmpty())
|
||||||
|
email.addType(EmailType.get(labelToXName(customType)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
c.getEmails().add(email);
|
c.getEmails().add(email);
|
||||||
@ -310,7 +314,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
impp.addType(ImppType.WORK);
|
impp.addType(ImppType.WORK);
|
||||||
break;
|
break;
|
||||||
case Im.TYPE_CUSTOM:
|
case Im.TYPE_CUSTOM:
|
||||||
impp.addType(ImppType.get(labelToXName(cursor.getString(2))));
|
String customType = cursor.getString(2);
|
||||||
|
if (customType != null && !customType.isEmpty())
|
||||||
|
impp.addType(ImppType.get(labelToXName(customType)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
c.getImpps().add(impp);
|
c.getImpps().add(impp);
|
||||||
@ -351,7 +357,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
address.addType(AddressType.WORK);
|
address.addType(AddressType.WORK);
|
||||||
break;
|
break;
|
||||||
case StructuredPostal.TYPE_CUSTOM:
|
case StructuredPostal.TYPE_CUSTOM:
|
||||||
address.addType(AddressType.get(labelToXName(cursor.getString(2))));
|
String customType = cursor.getString(2);
|
||||||
|
if (customType != null && !customType.isEmpty())
|
||||||
|
address.addType(AddressType.get(labelToXName(customType)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
address.setStreetAddress(cursor.getString(3));
|
address.setStreetAddress(cursor.getString(3));
|
||||||
|
@ -100,9 +100,6 @@ public abstract class LocalCollection<T extends Resource> {
|
|||||||
LinkedList<T> fresh = new LinkedList<T>();
|
LinkedList<T> fresh = new LinkedList<T>();
|
||||||
while (cursor != null && cursor.moveToNext()) {
|
while (cursor != null && cursor.moveToNext()) {
|
||||||
T resource = findById(cursor.getLong(0), true);
|
T resource = findById(cursor.getLong(0), true);
|
||||||
/*String uid = randomUID(),
|
|
||||||
resourceName = uid.replace("@", "_") + fileExtension();
|
|
||||||
resource.setUid(uid);*/
|
|
||||||
resource.initialize();
|
resource.initialize();
|
||||||
|
|
||||||
// new record: set generated UID + remote file name in database
|
// new record: set generated UID + remote file name in database
|
||||||
|
Loading…
Reference in New Issue
Block a user