diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-01-17 23:10:08 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-01-17 23:10:08 +0000 |
commit | 59dd2ddb9deb5b38cbfedf8b982a1f99b073262d (patch) | |
tree | 86ce3ef0a1b214788f506cb38de2b44fe7b8d499 | |
parent | 00eba538b0a8f1ee2d775216ddeb5ba2ececadd7 (diff) | |
download | craftbukkit-59dd2ddb9deb5b38cbfedf8b982a1f99b073262d.tar craftbukkit-59dd2ddb9deb5b38cbfedf8b982a1f99b073262d.tar.gz craftbukkit-59dd2ddb9deb5b38cbfedf8b982a1f99b073262d.tar.lz craftbukkit-59dd2ddb9deb5b38cbfedf8b982a1f99b073262d.tar.xz craftbukkit-59dd2ddb9deb5b38cbfedf8b982a1f99b073262d.zip |
SPIGOT-438: Correct CraftScoreboard.getObjective NPEing instead of returning null for missing objectives
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java index bb804101..97671474 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<Objective> getObjectivesByCriteria(String criteria) throws IllegalArgumentException { |