mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Prevent NPE
This commit is contained in:
parent
43dd1620c6
commit
55ba8e036e
1 changed files with 5 additions and 3 deletions
|
@ -372,9 +372,11 @@ class ImageHelper {
|
|||
if (++redirects > MAX_REDIRECTS)
|
||||
throw new IOException("Too many redirects");
|
||||
|
||||
String location = URLDecoder.decode(
|
||||
urlConnection.getHeaderField("Location"),
|
||||
StandardCharsets.UTF_8.name());
|
||||
String header = urlConnection.getHeaderField("Location");
|
||||
if (header == null)
|
||||
throw new IOException("Location header missing");
|
||||
|
||||
String location = URLDecoder.decode(header, StandardCharsets.UTF_8.name());
|
||||
url = new URL(url, location);
|
||||
Log.i("Redirect #" + redirects + " to " + url);
|
||||
|
||||
|
|
Loading…
Reference in a new issue