Skip to content

Commit b415f1b

Browse files
prevent npe if missing contenttype via webdav
1 parent 4e6c4ad commit b415f1b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/com/owncloud/android/lib/common/network/WebdavEntry.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@ public WebdavEntry(MultiStatusResponse ms, String splitElement) {
9292
mContentType = "application/octet-stream";
9393
prop = propSet.get(DavPropertyName.GETCONTENTTYPE);
9494
if (prop != null) {
95-
mContentType = (String) prop.getValue();
95+
String contentType = (String) prop.getValue();
9696
// dvelasco: some builds of ownCloud server 4.0.x added a trailing ';'
9797
// to the MIME type ; if looks fixed, but let's be cautious
98-
if (mContentType.indexOf(";") >= 0) {
99-
mContentType = mContentType.substring(0, mContentType.indexOf(";"));
98+
if (contentType != null) {
99+
if (contentType.contains(";")) {
100+
mContentType = contentType.substring(0, contentType.indexOf(";"));
101+
} else {
102+
mContentType = contentType;
103+
}
100104
}
101105
}
102106

0 commit comments

Comments
 (0)