diff --git a/mod-director-core/src/main/java/net/jan/moddirector/core/manage/select/InstallSelector.java b/mod-director-core/src/main/java/net/jan/moddirector/core/manage/select/InstallSelector.java index 484dcae..d620a20 100644 --- a/mod-director-core/src/main/java/net/jan/moddirector/core/manage/select/InstallSelector.java +++ b/mod-director-core/src/main/java/net/jan/moddirector/core/manage/select/InstallSelector.java @@ -31,47 +31,53 @@ public void accept( List ignoredGroups = new ArrayList<>(); for(ModDirectorRemoteMod mod : excludedMods) { - InstallationPolicy policy = mod.getInstallationPolicy(); - if(policy != null) { - String group = policy.getOptionalKey(); - if(group != null && !group.equals("$")) { - ignoredGroups.add(group); + if(mod != null) { + InstallationPolicy policy = mod.getInstallationPolicy(); + if(policy != null) { + String group = policy.getOptionalKey(); + if(group != null && !group.equals("$")) { + ignoredGroups.add(group); + } } } } for(InstallableMod mod : reInstall) { - ModDirectorRemoteMod remoteMod = mod.getRemoteMod(); - if(remoteMod != null) { - InstallationPolicy policy = remoteMod.getInstallationPolicy(); - if(policy != null) { - String group = policy.getOptionalKey(); - if(group != null && !group.equals("$")) { - ignoredGroups.add(group); + if(mod != null) { + ModDirectorRemoteMod remoteMod = mod.getRemoteMod(); + if(remoteMod != null) { + InstallationPolicy policy = remoteMod.getInstallationPolicy(); + if(policy != null) { + String group = policy.getOptionalKey(); + if(group != null && !group.equals("$")) { + ignoredGroups.add(group); + } } + alwaysInstall.add(mod); } - alwaysInstall.add(mod); } } for(InstallableMod mod : freshInstalls) { - ModDirectorRemoteMod remoteMod = mod.getRemoteMod(); - if(remoteMod != null) { - InstallationPolicy policy = remoteMod.getInstallationPolicy(); - String optionalKey = policy == null ? "$" : policy.getOptionalKey(); - if(!ignoredGroups.contains(optionalKey)) { - SelectableInstallOption installOption = new SelectableInstallOption( - policy == null || optionalKey == null || policy.isSelectedByDefault(), - policy == null || policy.getName() == null ? remoteMod.offlineName() : policy.getName() + " - " + remoteMod.offlineName(), - policy == null ? "" : policy.getDescription(), - policy == null || remoteMod.remoteType() == null ? "Unknown" : remoteMod.remoteType() - ); - if(optionalKey == null || optionalKey.equals("$")) { - singleOptions.add(installOption); - } else { - groupOptions.computeIfAbsent(optionalKey, k -> new ArrayList<>()).add(installOption); + if(mod != null) { + ModDirectorRemoteMod remoteMod = mod.getRemoteMod(); + if(remoteMod != null) { + InstallationPolicy policy = remoteMod.getInstallationPolicy(); + String optionalKey = policy == null ? "$" : policy.getOptionalKey(); + if(!ignoredGroups.contains(optionalKey)) { + SelectableInstallOption installOption = new SelectableInstallOption( + policy == null || optionalKey == null || policy.isSelectedByDefault(), + policy == null || policy.getName() == null ? remoteMod.offlineName() : policy.getName() + " - " + remoteMod.offlineName(), + policy == null ? "" : policy.getDescription(), + policy == null || remoteMod.remoteType() == null ? "Unknown" : remoteMod.remoteType() + ); + if(optionalKey == null || optionalKey.equals("$")) { + singleOptions.add(installOption); + } else { + groupOptions.computeIfAbsent(optionalKey, k -> new ArrayList<>()).add(installOption); + } + optionsToMod.put(installOption, mod); } - optionsToMod.put(installOption, mod); } } }