mirror of
https://github.com/etesync/android
synced 2025-02-02 10:51:10 +00:00
avoid NullPointerExceptions when contact data rows with custom types have no LABEL
This commit is contained in:
parent
3af25754c4
commit
d30715f813
@ -122,7 +122,7 @@ public class Event extends Resource {
|
||||
ComponentList events = ical.getComponents(Component.VEVENT);
|
||||
if (events == null || events.isEmpty())
|
||||
return;
|
||||
VEvent event = (VEvent)events.get(0);
|
||||
VEvent event = (VEvent)events.get(0);
|
||||
|
||||
if (event.getUid() != null)
|
||||
uid = event.getUid().getValue();
|
||||
|
@ -212,7 +212,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
||||
number.addType(Contact.PHONE_TYPE_MMS);
|
||||
break;
|
||||
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);
|
||||
}
|
||||
@ -234,7 +236,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
||||
email.addType(Contact.EMAIL_TYPE_MOBILE);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
c.getEmails().add(email);
|
||||
@ -310,7 +314,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
||||
impp.addType(ImppType.WORK);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
c.getImpps().add(impp);
|
||||
@ -351,7 +357,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
||||
address.addType(AddressType.WORK);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
address.setStreetAddress(cursor.getString(3));
|
||||
|
@ -100,9 +100,6 @@ public abstract class LocalCollection<T extends Resource> {
|
||||
LinkedList<T> fresh = new LinkedList<T>();
|
||||
while (cursor != null && cursor.moveToNext()) {
|
||||
T resource = findById(cursor.getLong(0), true);
|
||||
/*String uid = randomUID(),
|
||||
resourceName = uid.replace("@", "_") + fileExtension();
|
||||
resource.setUid(uid);*/
|
||||
resource.initialize();
|
||||
|
||||
// new record: set generated UID + remote file name in database
|
||||
|
@ -294,7 +294,7 @@ public class WebDavResource {
|
||||
multiget.prop.addressData = new DavProp.DavPropAddressData();
|
||||
else if (type == MultigetType.CALENDAR)
|
||||
multiget.prop.calendarData = new DavProp.DavPropCalendarData();
|
||||
|
||||
|
||||
multiget.hrefs = new ArrayList<DavHref>(names.length);
|
||||
for (String name : names)
|
||||
multiget.hrefs.add(new DavHref(location.resolve(name).getRawPath()));
|
||||
|
Loading…
Reference in New Issue
Block a user