diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-06-29 15:17:09 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-06-29 15:17:09 +0200 |
commit | 95f1beb479fac93e4c18e1b4e9a918777370dad5 (patch) | |
tree | 03d75016c35a6d7618af525ccde3d6646829dec8 /core/src | |
parent | 926f3912cfc774ebf89db9d668ec3d31c6634f70 (diff) | |
download | AntennaPod-95f1beb479fac93e4c18e1b4e9a918777370dad5.zip |
Downloader: Check content-type for null
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java | 7 |
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; } |