From 95f1beb479fac93e4c18e1b4e9a918777370dad5 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Wed, 29 Jun 2016 15:17:09 +0200 Subject: [PATCH] Downloader: Check content-type for null --- .../antennapod/core/service/download/HttpDownloader.java | 7 ++++--- 1 file 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; }