1
0
mirror of https://github.com/etesync/android synced 2025-02-20 11:32:10 +00:00

fix potential crash bug when server returns no collection members

This commit is contained in:
rfc2822 2013-10-16 18:22:59 +02:00
parent 59ded55ac1
commit c87fb7bedd

View File

@ -40,8 +40,8 @@ public class WebDavCollection extends WebDavResource {
CALENDAR CALENDAR
} }
/* list of resource members, null until filled by propfind() or multiGet() */ /* list of resource members, empty until filled by propfind() or multiGet() */
@Getter protected List<WebDavResource> members; @Getter protected List<WebDavResource> members = new LinkedList<WebDavResource>();
public WebDavCollection(URI baseURL, String username, String password, boolean preemptiveAuth) throws IOException { public WebDavCollection(URI baseURL, String username, String password, boolean preemptiveAuth) throws IOException {
@ -151,11 +151,12 @@ public class WebDavCollection extends WebDavResource {
/* HTTP support */ /* HTTP support */
protected void processMultiStatus(DavMultistatus multistatus) throws HttpException { protected void processMultiStatus(DavMultistatus multistatus) throws HttpException {
List<WebDavResource> members = new LinkedList<WebDavResource>();
if (multistatus.response == null) // empty response if (multistatus.response == null) // empty response
return; return;
// member list will be built from response
members.clear();
for (DavResponse singleResponse : multistatus.response) { for (DavResponse singleResponse : multistatus.response) {
String href = singleResponse.getHref().href; String href = singleResponse.getHref().href;
@ -225,7 +226,6 @@ public class WebDavCollection extends WebDavResource {
referenced.content = new ByteArrayInputStream(prop.addressData.vcard.getBytes()); referenced.content = new ByteArrayInputStream(prop.addressData.vcard.getBytes());
} }
} }
this.members = members;
} }