Fix NPE when in a mod loader dev env

dev/0.11
modmuss50 2021-07-27 20:56:24 +01:00
parent b955affb1a
commit 32837d71eb
1 changed files with 8 additions and 1 deletions

View File

@ -42,6 +42,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.configuration.InstallerData;
import net.fabricmc.loom.util.OperatingSystem; import net.fabricmc.loom.util.OperatingSystem;
public class RunConfig { public class RunConfig {
@ -207,7 +208,13 @@ public class RunConfig {
} }
private static String getMainClass(String side, LoomGradleExtension extension, String defaultMainClass) { private static String getMainClass(String side, LoomGradleExtension extension, String defaultMainClass) {
JsonObject installerJson = extension.getInstallerData().installerJson(); InstallerData installerData = extension.getInstallerData();
if (installerData == null) {
return defaultMainClass;
}
JsonObject installerJson = installerData.installerJson();
if (installerJson != null && installerJson.has("mainClass")) { if (installerJson != null && installerJson.has("mainClass")) {
JsonElement mainClassJson = installerJson.get("mainClass"); JsonElement mainClassJson = installerJson.get("mainClass");