handle null proxy configuration when fetching proxy

This commit is contained in:
Craig Raw 2024-04-17 14:11:41 +02:00
parent f245b57022
commit a5050117a3

View file

@ -502,7 +502,7 @@ public class AppServices {
public static Proxy getProxy(String proxyCircuitId) { public static Proxy getProxy(String proxyCircuitId) {
Config config = Config.get(); Config config = Config.get();
Proxy proxy = null; Proxy proxy = null;
if(config.isUseProxy()) { if(config.isUseProxy() && config.getProxyServer() != null) {
HostAndPort proxyHostAndPort = HostAndPort.fromString(config.getProxyServer()); HostAndPort proxyHostAndPort = HostAndPort.fromString(config.getProxyServer());
InetSocketAddress proxyAddress = new InetSocketAddress(proxyHostAndPort.getHost(), proxyHostAndPort.getPortOrDefault(ProxyTcpOverTlsTransport.DEFAULT_PROXY_PORT)); InetSocketAddress proxyAddress = new InetSocketAddress(proxyHostAndPort.getHost(), proxyHostAndPort.getPortOrDefault(ProxyTcpOverTlsTransport.DEFAULT_PROXY_PORT));
proxy = new Proxy(Proxy.Type.SOCKS, proxyAddress); proxy = new Proxy(Proxy.Type.SOCKS, proxyAddress);