summaryrefslogtreecommitdiff
path: root/core/src/main/java/de/danoeh/antennapod
diff options
context:
space:
mode:
authorMartin Fietz <Martin.Fietz@gmail.com>2016-06-29 15:17:09 +0200
committerMartin Fietz <Martin.Fietz@gmail.com>2016-06-29 15:17:09 +0200
commit95f1beb479fac93e4c18e1b4e9a918777370dad5 (patch)
tree03d75016c35a6d7618af525ccde3d6646829dec8 /core/src/main/java/de/danoeh/antennapod
parent926f3912cfc774ebf89db9d668ec3d31c6634f70 (diff)
downloadAntennaPod-95f1beb479fac93e4c18e1b4e9a918777370dad5.zip
Downloader: Check content-type for null
Diffstat (limited to 'core/src/main/java/de/danoeh/antennapod')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java
index c259f16a2..869cb8f7a 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java
@@ -185,8 +185,6 @@ public class HttpDownloader extends Downloader {
// fail with a file type error when the content type is text and
// the reported content length is less than 100kb (or no length is given)
if(request.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
- String contentType = response.header("Content-Type");
- Log.d(TAG, "content type: " + contentType);
int contentLength = -1;
String contentLen = response.header("Content-Length");
if(contentLen != null) {
@@ -195,7 +193,10 @@ public class HttpDownloader extends Downloader {
} catch(NumberFormatException e) {}
}
Log.d(TAG, "content length: " + contentLength);
- if(contentType.startsWith("text/") && contentLength < 100 * 1024) {
+ String contentType = response.header("Content-Type");
+ Log.d(TAG, "content type: " + contentType);
+ if(contentType != null && contentType.startsWith("text/") &&
+ contentLength < 100 * 1024) {
onFail(DownloadError.ERROR_FILE_TYPE, null);
return;
}