SPIGOT-7949: Registering a new scoreboard objective with an empty display name throws a NPE

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-11-06 20:22:58 +11:00
parent b9a4bb1cd1
commit 30af9c34dd

View file

@ -55,7 +55,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
Preconditions.checkArgument(name.length() <= Short.MAX_VALUE, "The name '%s' is longer than the limit of 32767 characters (%s)", name, name.length());
Preconditions.checkArgument(board.getObjective(name) == null, "An objective of name '%s' already exists", name);
ScoreboardObjective objective = board.addObjective(name, ((CraftCriteria) criteria).criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType), true, null);
ScoreboardObjective objective = board.addObjective(name, ((CraftCriteria) criteria).criteria, CraftChatMessage.fromStringOrEmpty(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType), true, null);
return new CraftObjective(this, objective);
}