From ea31f5a621137ac1ee3e2d53313873b855e08917 Mon Sep 17 00:00:00 2001 From: rfc2822 Date: Sun, 26 Jan 2014 12:50:50 +0100 Subject: [PATCH] Fix crash when ROLE/TITLE but no ORG value set (fixes #163) --- .../bitfire/davdroid/resource/LocalAddressBook.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/at/bitfire/davdroid/resource/LocalAddressBook.java b/src/at/bitfire/davdroid/resource/LocalAddressBook.java index dce27d73..102b76d2 100644 --- a/src/at/bitfire/davdroid/resource/LocalAddressBook.java +++ b/src/at/bitfire/davdroid/resource/LocalAddressBook.java @@ -699,11 +699,13 @@ public class LocalAddressBook extends LocalCollection { protected Builder buildOrganization(Builder builder, ezvcard.property.Organization organization, String jobTitle, String jobDescription) { String company = null, department = null; - Iterator org = organization.getValues().iterator(); - if (org.hasNext()) - company = org.next(); - if (org.hasNext()) - department = org.next(); + if (organization != null) { + Iterator org = organization.getValues().iterator(); + if (org.hasNext()) + company = org.next(); + if (org.hasNext()) + department = org.next(); + } return builder .withValue(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE)