Fix NPE when onion address is empty
This commit is contained in:
@@ -50,6 +50,7 @@ import okhttp3.OkHttpClient;
|
|||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpHelper;
|
import org.sufficientlysecure.keychain.pgp.PgpHelper;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
@@ -154,7 +155,7 @@ public class ParcelableHkpKeyserver extends Keyserver implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public URI getOnionURI() throws URISyntaxException {
|
public URI getOnionURI() throws URISyntaxException {
|
||||||
return getURI(mOnion);
|
return mOnion != null ? getURI(mOnion) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,10 +190,12 @@ public class ParcelableHkpKeyserver extends Keyserver implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HttpUrl getHttpUrl(ParcelableProxy proxy) throws URISyntaxException {
|
private HttpUrl getHttpUrl(ParcelableProxy proxy) throws URISyntaxException {
|
||||||
HttpUrl base = proxy.isTorEnabled() ? HttpUrl.get(getOnionURI())
|
URI base = getUrlURI();
|
||||||
: HttpUrl.get(getUrlURI());
|
if (proxy.isTorEnabled() && getOnionURI() != null) {
|
||||||
|
base = getOnionURI();
|
||||||
|
}
|
||||||
|
|
||||||
return base.newBuilder()
|
return HttpUrl.get(base).newBuilder()
|
||||||
.addPathSegment("pks")
|
.addPathSegment("pks")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user