mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-21 17:56:16 +01:00
Fix potential NPE
This commit is contained in:
parent
e4300e76e2
commit
ce262c62f0
@ -70,10 +70,10 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
|
||||
queue(host.getName(), () -> client.sendPacket(new PacketLinkExHost(0, null)));
|
||||
setReady(client);
|
||||
} else {
|
||||
client.sendPacket(new PacketLinkExHost(3, "Host already linked"));
|
||||
client.sendPacket(new PacketLinkExHost(3, "Host already linked: " + data.getString(0x0000)));
|
||||
}
|
||||
} else {
|
||||
client.sendPacket(new PacketLinkExHost(4, "That host does not support a network interface"));
|
||||
client.sendPacket(new PacketLinkExHost(4, "Requested host does not support network interfaces: " + data.getString(0x0000)));
|
||||
}
|
||||
} else {
|
||||
client.sendPacket(new PacketLinkExHost(2, "There is no host with name: " + data.getString(0x0000)));
|
||||
|
@ -81,7 +81,7 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
|
||||
queue(proxy.getName(), () -> client.sendPacket(new PacketLinkProxy(proxy.getName(), 0, null)));
|
||||
setReady(client);
|
||||
} else {
|
||||
client.sendPacket(new PacketLinkProxy(proxy.getName(), 2, "Proxy already linked"));
|
||||
client.sendPacket(new PacketLinkProxy(null, 2, "Proxy already linked: " + proxy.getName()));
|
||||
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
@ -176,7 +176,7 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
||||
last = now;
|
||||
setReady(client);
|
||||
} else {
|
||||
client.sendPacket(new PacketLinkServer(null, 4, "Server already linked"));
|
||||
client.sendPacket(new PacketLinkServer(null, 4, "Server already linked: " + server.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ public class SubServerImpl {
|
||||
|
||||
private void run() {
|
||||
boolean falsestart = true;
|
||||
int exit = Integer.MIN_VALUE;
|
||||
allowrestart = true;
|
||||
try {
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getString("Git-Bash"), executable)).directory(directory);
|
||||
@ -121,6 +122,7 @@ public class SubServerImpl {
|
||||
queue.clear();
|
||||
|
||||
if (process.isAlive()) process.waitFor();
|
||||
exit = process.exitValue();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
host.log.error.println(e);
|
||||
allowrestart = false;
|
||||
@ -128,8 +130,8 @@ public class SubServerImpl {
|
||||
}
|
||||
|
||||
logger.destroy();
|
||||
if (SubAPI.getInstance().getSubDataNetwork()[0] != null) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketExControlServer(this, Response.STOPPED, (Integer) process.exitValue(), (Boolean) allowrestart));
|
||||
if (SubAPI.getInstance().getSubDataNetwork()[0] != null) { // noinspection UnnecessaryBoxing
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketExControlServer(this, Response.STOPPED, Integer.valueOf(exit), Boolean.valueOf(allowrestart)));
|
||||
}
|
||||
host.log.info.println(name + " has stopped");
|
||||
process = null;
|
||||
|
Loading…
Reference in New Issue
Block a user