From 59dd2ddb9deb5b38cbfedf8b982a1f99b073262d Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 17 Jan 2015 23:10:08 +0000 Subject: [PATCH] SPIGOT-438: Correct CraftScoreboard.getObjective NPEing instead of returning null for missing objectives --- .../org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java index bb804101ff..9767147480 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -37,7 +37,8 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { public Objective getObjective(String name) throws IllegalArgumentException { Validate.notNull(name, "Name cannot be null"); - return new CraftObjective(this, board.getObjective(name)); + ScoreboardObjective nms = board.getObjective(name); + return nms == null ? null : new CraftObjective(this, nms); } public ImmutableSet getObjectivesByCriteria(String criteria) throws IllegalArgumentException {