From e126623b6f8506ea491226c999e564b88bed7718 Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 13 Oct 2018 15:30:05 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B0=20=D0=BA=D1=80=D0=B0=D1=88=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=86=D0=B5=D1=81=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gravit/launcher/client/ClientLauncher.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java index 1ded38f9..82b45e18 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -285,7 +285,7 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl System.setProperty("minecraft.applet.TargetDirectory", params.clientDir.toString()); // For 1.5.2 mainMethod.invoke((Object) args.toArray(EMPTY_ARRAY)); } - + private static Process process = null; @LauncherAPI public static Process launch( @@ -301,6 +301,17 @@ public static Process launch( socket.setReuseAddress(true); socket.bind(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT)); Socket client = socket.accept(); + if(process == null) + { + LogHelper.error("Process is null"); + return; + } + if(!process.isAlive()) + { + LogHelper.error("Process is not alive"); + JOptionPane.showMessageDialog(null,"Client Process crashed","Launcher",JOptionPane.ERROR_MESSAGE); + return; + } try (HOutput output = new HOutput(client.getOutputStream())) { params.write(output); profile.write(output); @@ -375,7 +386,8 @@ public static Process launch( builder.redirectOutput(Redirect.PIPE); } // Let's rock! - return builder.start(); + process = builder.start(); + return process; } @LauncherAPI