Prevent NPE

pull/168/head
M66B 5 years ago
parent 43dd1620c6
commit 55ba8e036e

@ -372,9 +372,11 @@ class ImageHelper {
if (++redirects > MAX_REDIRECTS) if (++redirects > MAX_REDIRECTS)
throw new IOException("Too many redirects"); throw new IOException("Too many redirects");
String location = URLDecoder.decode( String header = urlConnection.getHeaderField("Location");
urlConnection.getHeaderField("Location"), if (header == null)
StandardCharsets.UTF_8.name()); throw new IOException("Location header missing");
String location = URLDecoder.decode(header, StandardCharsets.UTF_8.name());
url = new URL(url, location); url = new URL(url, location);
Log.i("Redirect #" + redirects + " to " + url); Log.i("Redirect #" + redirects + " to " + url);

Loading…
Cancel
Save