From e7f6b6f3f5d90516a97cbf9b63c5d83307bc9394 Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 10 Aug 2019 18:37:05 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=A7=D0=B5=D0=BB=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D0=BA=D0=BE=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D0=BC=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=B0=D1=80=D1=83=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BC=D1=83=D1=81=D0=BE=D1=80=D0=B0=20=D0=B2=20module?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro/gravit/launcher/managers/SimpleModuleManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/managers/SimpleModuleManager.java b/LauncherAPI/src/main/java/pro/gravit/launcher/managers/SimpleModuleManager.java index 8a929b78..f6ecda38 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/managers/SimpleModuleManager.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/managers/SimpleModuleManager.java @@ -28,7 +28,13 @@ private ModulesVisitor() { public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.toFile().getName().endsWith(".jar")) try (JarFile f = new JarFile(file.toFile())) { - loadModule(file.toUri().toURL(), f.getManifest().getMainAttributes().getValue("Main-Class")); + String mainclass = f.getManifest().getMainAttributes().getValue("Main-Class"); + if(mainclass == null) + { + LogHelper.error("In module %s Main-Class not found", file.toString()); + return super.visitFile(file, attrs); + } + loadModule(file.toUri().toURL(), mainclass); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LogHelper.error(e); }