Skip to content

Commit

Permalink
Improve hasErrors implementations (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt authored Jun 3, 2024
1 parent 1ca21b0 commit 1b6af92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion loader/src/main/java/net/neoforged/fml/ModLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public static <T extends Event & IModBusEvent> void postEventWithWrapInModOrder(
* If you are running in a Mixin before mod loading has actually started, check {@link LoadingModList#hasErrors()} instead.
*/
public static boolean hasErrors() {
return loadingIssues.stream().anyMatch(issue -> issue.severity() == ModLoadingIssue.Severity.ERROR);
return !loadingIssues.isEmpty() && loadingIssues.stream().anyMatch(issue -> issue.severity() == ModLoadingIssue.Severity.ERROR);
}

@ApiStatus.Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public List<ModInfo> getDependencies(IModInfo mod) {
}

public boolean hasErrors() {
return modLoadingIssues.stream().noneMatch(issue -> issue.severity() == ModLoadingIssue.Severity.ERROR);
return !modLoadingIssues.isEmpty() && modLoadingIssues.stream().anyMatch(issue -> issue.severity() == ModLoadingIssue.Severity.ERROR);
}

public List<ModLoadingIssue> getModLoadingIssues() {
Expand Down

0 comments on commit 1b6af92

Please sign in to comment.