Skip to content

Commit

Permalink
Additional install selector null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Apr 10, 2024
1 parent 394f5d6 commit f360f9a
Showing 1 changed file with 35 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,53 @@ public void accept(
List<String> 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);
}
}
}
Expand Down

1 comment on commit f360f9a

@ACGaming
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10

Please sign in to comment.