From 58ff00db961641164411564fe1c6d9406750f991 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 16 Dec 2023 23:42:59 +0100 Subject: [PATCH] Fixed an issue where there would be a null score in SetScorePacket --- .../java/org/geysermc/geyser/scoreboard/Scoreboard.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index 1e0ea5eb1..216370bde 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -258,7 +258,12 @@ public final class Scoreboard { for (Score score : objective.getScores().values()) { if (score.getUpdateType() == REMOVE) { - removeScores.add(score.getCachedInfo()); + ScoreInfo cachedInfo = score.getCachedInfo(); + // cachedInfo can be null here when ScoreboardUpdater is being used and a score is added and + // removed before a single update cycle is performed + if (cachedInfo != null) { + removeScores.add(cachedInfo); + } // score is pending to be removed, so we can remove it from the objective objective.removeScore0(score.getName()); break;