From 55578ab88c539765b79b2fac7c4cd875cf97ccfc Mon Sep 17 00:00:00 2001 From: BONNe Date: Tue, 5 Feb 2019 09:23:49 +0200 Subject: [PATCH] Fix null-pointer crash when loading invalid challenge level. --- .../world/bentobox/challenges/ChallengesManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/challenges/ChallengesManager.java b/src/main/java/world/bentobox/challenges/ChallengesManager.java index 6f6b44d..ab3e569 100644 --- a/src/main/java/world/bentobox/challenges/ChallengesManager.java +++ b/src/main/java/world/bentobox/challenges/ChallengesManager.java @@ -214,8 +214,15 @@ public class ChallengesManager { if (!this.isValidLevel(level)) { - user.sendMessage("challenges.admin.import.error", + if (user != null) + { + user.sendMessage("challenges.admin.import.error", "[object]", level.getFriendlyName()); + } + else + { + this.addon.logError("Challenge Level '" + level.getUniqueId() + "' is not valid and skipped"); + } return false; }