Fix crash when a server returns a null location
This commit is contained in:
parent
e83f746b36
commit
32ac7f7f71
@ -77,6 +77,9 @@ public class AntennapodHttpClient {
|
|||||||
if (response.code() == HttpURLConnection.HTTP_MOVED_PERM
|
if (response.code() == HttpURLConnection.HTTP_MOVED_PERM
|
||||||
|| response.code() == StatusLine.HTTP_PERM_REDIRECT) {
|
|| response.code() == StatusLine.HTTP_PERM_REDIRECT) {
|
||||||
String location = response.header("Location");
|
String location = response.header("Location");
|
||||||
|
if (location == null) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
if (location.startsWith("/")) { // URL is not absolute, but relative
|
if (location.startsWith("/")) { // URL is not absolute, but relative
|
||||||
HttpUrl url = request.url();
|
HttpUrl url = request.url();
|
||||||
location = url.scheme() + "://" + url.host() + location;
|
location = url.scheme() + "://" + url.host() + location;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user