Skip to content

Commit

Permalink
Merge pull request #6710 from TownyAdvanced/fix/null-mayor-npe
Browse files Browse the repository at this point in the history
Fix the seventh null mayor npe
  • Loading branch information
LlmDl authored May 31, 2023
2 parents 8e349bb + 6b92cb8 commit c298b55
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public class TownyFormatter {
public static final SimpleDateFormat lastOnlineFormat = new SimpleDateFormat("MMMMM dd '@' HH:mm");
Expand Down Expand Up @@ -160,7 +161,7 @@ public static StatusScreen getStatus(Resident resident, CommandSender sender) {
.append(Component.newline())
.append(TownyComponents.miniMessage(getResidentJoinedTownDate(resident, translator)))
.append(Component.newline())
.append(TownyComponents.miniMessage(colourKeyValue(translator.of("rank_list_mayor"), town.getMayor().getFormattedName())))
.append(TownyComponents.miniMessage(colourKeyValue(translator.of("rank_list_mayor"), Optional.ofNullable(town.getMayor()).map(Resident::getFormattedName).orElse("null"))))
.append(Component.newline())
.append(TownyComponents.miniMessage(colourKeyValue(translator.of("res_list"), StringMgmt.join(residents, ", "))))
.append(Component.newline())
Expand Down

0 comments on commit c298b55

Please sign in to comment.