From 1d3e180020b817436359c867fe8dc757af948fc4 Mon Sep 17 00:00:00 2001 From: Julian Burner Date: Sat, 26 Nov 2022 00:50:48 +0100 Subject: [PATCH] Fix NPEs --- src/matcher/PluginLoader.java | 2 +- src/matcher/gui/Gui.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/matcher/PluginLoader.java b/src/matcher/PluginLoader.java index 7cf00182..8ca378a4 100644 --- a/src/matcher/PluginLoader.java +++ b/src/matcher/PluginLoader.java @@ -23,7 +23,7 @@ public static void run(String[] args) { for (int i = 0; i < args.length; i++) { switch (args[i]) { case "--additional-plugins": - while (!args[i+1].startsWith("--")) { + while (i+1 < args.length && !args[i+1].startsWith("--")) { pluginPaths.add(Path.of(args[++i])); } diff --git a/src/matcher/gui/Gui.java b/src/matcher/gui/Gui.java index 2033e5f3..f7b5564e 100644 --- a/src/matcher/gui/Gui.java +++ b/src/matcher/gui/Gui.java @@ -135,35 +135,35 @@ private void handleStartupArgs(List args) { // ProjectConfig args case "--inputs-a": - while (!args.get(i+1).startsWith("--")) { + while (i+1 < args.size() && !args.get(i+1).startsWith("--")) { inputsA.add(Path.of(args.get(++i))); validProjectConfigArgPresent = true; } break; case "--inputs-b": - while (!args.get(i+1).startsWith("--")) { + while (i+1 < args.size() && !args.get(i+1).startsWith("--")) { inputsB.add(Path.of(args.get(++i))); validProjectConfigArgPresent = true; } break; case "--classpath-a": - while (!args.get(i+1).startsWith("--")) { + while (i+1 < args.size() && !args.get(i+1).startsWith("--")) { classPathA.add(Path.of(args.get(++i))); validProjectConfigArgPresent = true; } break; case "--classpath-b": - while (!args.get(i+1).startsWith("--")) { + while (i+1 < args.size() && !args.get(i+1).startsWith("--")) { classPathB.add(Path.of(args.get(++i))); validProjectConfigArgPresent = true; } break; case "--shared-classpath": - while (!args.get(i+1).startsWith("--")) { + while (i+1 < args.size() && !args.get(i+1).startsWith("--")) { sharedClassPath.add(Path.of(args.get(++i))); validProjectConfigArgPresent = true; }