Skip to content

Commit

Permalink
Merge pull request #4542 from IllianiCBT/education_massEnrollNPE
Browse files Browse the repository at this point in the history
Fixed NPE in Mass Enroll Filters
  • Loading branch information
IllianiCBT authored Aug 7, 2024
2 parents 76e9cea + 1b488c6 commit 877bcd9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3007,8 +3007,13 @@ private void buildEducationMenusMassEnroll(Campaign campaign, List<Person> perso
// find the first faction that accepts applications from all persons in personnel
Optional<String> suitableFaction = personnel.stream()
.map(person -> academy.getFilteredFaction(campaign, person, campaign.getCurrentSystem().getFactions(campaign.getLocalDate())))
.filter(faction -> personnel.stream().allMatch(person -> faction.equals(academy.getFilteredFaction(campaign, person, campaign.getCurrentSystem().getFactions(campaign.getLocalDate())))))
.filter(faction -> personnel.stream().allMatch(person ->
Objects.equals(
faction,
academy.getFilteredFaction(campaign, person, campaign.getCurrentSystem().getFactions(campaign.getLocalDate()))
)))
.distinct()
.filter(Objects::nonNull)
.findFirst();

if (suitableFaction.isPresent()) {
Expand Down

0 comments on commit 877bcd9

Please sign in to comment.