Fix crash when a server returns a null location

This commit is contained in:
ByteHamster 2021-07-17 18:16:34 +02:00
parent e83f746b36
commit 32ac7f7f71
1 changed files with 3 additions and 0 deletions

View File

@ -77,6 +77,9 @@ public class AntennapodHttpClient {
if (response.code() == HttpURLConnection.HTTP_MOVED_PERM
|| response.code() == StatusLine.HTTP_PERM_REDIRECT) {
String location = response.header("Location");
if (location == null) {
return response;
}
if (location.startsWith("/")) { // URL is not absolute, but relative
HttpUrl url = request.url();
location = url.scheme() + "://" + url.host() + location;