diff --git a/library/src/main/java/com/owncloud/android/lib/common/utils/WebDavFileUtils.java b/library/src/main/java/com/owncloud/android/lib/common/utils/WebDavFileUtils.java index b6c3f90b0e..2bdc0fe765 100644 --- a/library/src/main/java/com/owncloud/android/lib/common/utils/WebDavFileUtils.java +++ b/library/src/main/java/com/owncloud/android/lib/common/utils/WebDavFileUtils.java @@ -53,6 +53,7 @@ import at.bitfire.dav4jvm.property.GetContentType; import at.bitfire.dav4jvm.property.GetLastModified; import at.bitfire.dav4jvm.property.ResourceType; +import okhttp3.MediaType; /** * WebDav helper. @@ -125,7 +126,13 @@ public RemoteFile parseResponse(Response response, Uri filesDavUri) { } if (property instanceof GetContentType) { - remoteFile.setMimeType(((GetContentType) property).getType().toString()); + MediaType type = ((GetContentType) property).getType(); + + if (type != null) { + remoteFile.setMimeType(type.toString()); + } else { + remoteFile.setMimeType(""); + } } if (property instanceof ResourceType) {