From 27bf5d6c1e678fd91f145808f6ff93ecd462d25d Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Fri, 21 Dec 2018 14:09:58 +0100 Subject: [PATCH] HttpClient: Fix NullPointerException if response has no content type. --- enabler/src/de/schildbach/pte/util/HttpClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enabler/src/de/schildbach/pte/util/HttpClient.java b/enabler/src/de/schildbach/pte/util/HttpClient.java index 86e066e1..ae44b1fc 100644 --- a/enabler/src/de/schildbach/pte/util/HttpClient.java +++ b/enabler/src/de/schildbach/pte/util/HttpClient.java @@ -101,7 +101,7 @@ public final class HttpClient { public Response intercept(final Interceptor.Chain chain) throws IOException { Response response = chain.proceed(chain.request()); final MediaType originalContentType = response.body().contentType(); - if ("text".equalsIgnoreCase(originalContentType.type()) + if (originalContentType != null && "text".equalsIgnoreCase(originalContentType.type()) && "xml".equalsIgnoreCase(originalContentType.subtype()) && originalContentType.charset() == null) { final String peek = response.peekBody(64).string();