Commit c4982250 authored by Ricki Hirner's avatar Ricki Hirner

Resource detection: fix NPE

parent 879b137c
...@@ -45,7 +45,6 @@ import at.bitfire.dav4android.property.DisplayName; ...@@ -45,7 +45,6 @@ import at.bitfire.dav4android.property.DisplayName;
import at.bitfire.dav4android.property.ResourceType; import at.bitfire.dav4android.property.ResourceType;
import at.bitfire.dav4android.property.SupportedCalendarComponentSet; import at.bitfire.dav4android.property.SupportedCalendarComponentSet;
import at.bitfire.davdroid.HttpClient; import at.bitfire.davdroid.HttpClient;
import at.bitfire.davdroid.InvalidAccountException;
import at.bitfire.davdroid.log.StringHandler; import at.bitfire.davdroid.log.StringHandler;
import at.bitfire.davdroid.model.CollectionInfo; import at.bitfire.davdroid.model.CollectionInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -178,7 +177,7 @@ public class DavResourceFinder { ...@@ -178,7 +177,7 @@ public class DavResourceFinder {
// check for resource type "principal" // check for resource type "principal"
if (principal == null) { if (principal == null) {
ResourceType resourceType = (ResourceType)davBase.properties.get(ResourceType.NAME); 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; principal = davBase.location;
} }
...@@ -319,7 +318,7 @@ public class DavResourceFinder { ...@@ -319,7 +318,7 @@ public class DavResourceFinder {
DavResource dav = new DavResource(httpClient, url, log); DavResource dav = new DavResource(httpClient, url, log);
dav.propfind(0, CurrentUserPrincipal.NAME); 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) { if (currentUserPrincipal != null && currentUserPrincipal.href != null) {
HttpUrl principal = dav.location.resolve(currentUserPrincipal.href); HttpUrl principal = dav.location.resolve(currentUserPrincipal.href);
if (principal != null) { if (principal != null) {
......
Subproject commit aa7480cf952d8b86e64637713ebf47e7cb2b4a35 Subproject commit 2d01d3b45d71e18d256fbb9d3b131b45b57c1f34
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment