fix: NPE
This commit is contained in:
@@ -138,6 +138,7 @@ public class DefaultLauncher extends Launcher {
|
|||||||
Proxy proxy = options.getProxy();
|
Proxy proxy = options.getProxy();
|
||||||
if (proxy != null && StringUtils.isBlank(options.getProxyUser()) && StringUtils.isBlank(options.getProxyPass())) {
|
if (proxy != null && StringUtils.isBlank(options.getProxyUser()) && StringUtils.isBlank(options.getProxyPass())) {
|
||||||
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
||||||
|
if (address != null) {
|
||||||
String host = address.getHostString();
|
String host = address.getHostString();
|
||||||
int port = address.getPort();
|
int port = address.getPort();
|
||||||
if (proxy.type() == Proxy.Type.HTTP) {
|
if (proxy.type() == Proxy.Type.HTTP) {
|
||||||
@@ -150,6 +151,7 @@ public class DefaultLauncher extends Launcher {
|
|||||||
res.add("-DsocksProxyPort=" + port);
|
res.add("-DsocksProxyPort=" + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LinkedList<String> classpath = new LinkedList<>();
|
LinkedList<String> classpath = new LinkedList<>();
|
||||||
for (Library library : version.getLibraries())
|
for (Library library : version.getLibraries())
|
||||||
@@ -202,6 +204,7 @@ public class DefaultLauncher extends Launcher {
|
|||||||
|
|
||||||
if (options.getProxy() != null) {
|
if (options.getProxy() != null) {
|
||||||
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
||||||
|
if (address != null) {
|
||||||
res.add("--proxyHost");
|
res.add("--proxyHost");
|
||||||
res.add(address.getHostString());
|
res.add(address.getHostString());
|
||||||
res.add("--proxyPort");
|
res.add("--proxyPort");
|
||||||
@@ -213,6 +216,7 @@ public class DefaultLauncher extends Launcher {
|
|||||||
res.add(options.getProxyPass());
|
res.add(options.getProxyPass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(options.getMinecraftArgs()))
|
if (StringUtils.isNotBlank(options.getMinecraftArgs()))
|
||||||
res.addAllWithoutParsing(StringUtils.tokenize(options.getMinecraftArgs()));
|
res.addAllWithoutParsing(StringUtils.tokenize(options.getMinecraftArgs()));
|
||||||
|
|||||||
Reference in New Issue
Block a user