From acbeb3d77f5f2d1d812f84e45b739f8ae79ccdef Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Fri, 10 Feb 2017 15:52:44 +0100 Subject: [PATCH] Guard against null scores for players who manage to die in the lobby. Fixes #319 --- .../com/garbagemule/MobArena/ScoreboardManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/garbagemule/MobArena/ScoreboardManager.java b/src/main/java/com/garbagemule/MobArena/ScoreboardManager.java index cc62e70..f16db8b 100644 --- a/src/main/java/com/garbagemule/MobArena/ScoreboardManager.java +++ b/src/main/java/com/garbagemule/MobArena/ScoreboardManager.java @@ -62,12 +62,21 @@ public class ScoreboardManager { * @param player a player */ void death(Player player) { + if (kills == null) { + return; + } + String name = ChatColor.GRAY + player.getName(); if (name.length() > 16) { name = name.substring(0, 15); } - int value = kills.getScore(player).getScore(); + Score score = kills.getScore(player); + if (score == null) { + return; + } + + int value = score.getScore(); scoreboard.resetScores(player); /* In case the player has no kills, they will not show up on the