From c4982250644f0368806e24773409917f84765724 Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Tue, 29 Mar 2016 15:19:53 +0200 Subject: [PATCH] Resource detection: fix NPE --- .../java/at/bitfire/davdroid/ui/setup/DavResourceFinder.java | 5 ++--- dav4android | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/at/bitfire/davdroid/ui/setup/DavResourceFinder.java b/app/src/main/java/at/bitfire/davdroid/ui/setup/DavResourceFinder.java index 87ab012d..bf208585 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/setup/DavResourceFinder.java +++ b/app/src/main/java/at/bitfire/davdroid/ui/setup/DavResourceFinder.java @@ -45,7 +45,6 @@ import at.bitfire.dav4android.property.DisplayName; import at.bitfire.dav4android.property.ResourceType; import at.bitfire.dav4android.property.SupportedCalendarComponentSet; import at.bitfire.davdroid.HttpClient; -import at.bitfire.davdroid.InvalidAccountException; import at.bitfire.davdroid.log.StringHandler; import at.bitfire.davdroid.model.CollectionInfo; import lombok.RequiredArgsConstructor; @@ -178,7 +177,7 @@ public class DavResourceFinder { // check for resource type "principal" if (principal == null) { ResourceType resourceType = (ResourceType)davBase.properties.get(ResourceType.NAME); - if (resourceType.types.contains(ResourceType.PRINCIPAL)) + if (resourceType != null && resourceType.types.contains(ResourceType.PRINCIPAL)) principal = davBase.location; } @@ -319,7 +318,7 @@ public class DavResourceFinder { DavResource dav = new DavResource(httpClient, url, log); dav.propfind(0, CurrentUserPrincipal.NAME); - CurrentUserPrincipal currentUserPrincipal = (CurrentUserPrincipal) dav.properties.get(CurrentUserPrincipal.NAME); + CurrentUserPrincipal currentUserPrincipal = (CurrentUserPrincipal)dav.properties.get(CurrentUserPrincipal.NAME); if (currentUserPrincipal != null && currentUserPrincipal.href != null) { HttpUrl principal = dav.location.resolve(currentUserPrincipal.href); if (principal != null) { diff --git a/dav4android b/dav4android index aa7480cf..2d01d3b4 160000 --- a/dav4android +++ b/dav4android @@ -1 +1 @@ -Subproject commit aa7480cf952d8b86e64637713ebf47e7cb2b4a35 +Subproject commit 2d01d3b45d71e18d256fbb9d3b131b45b57c1f34