From 99d4598c1615ac98788c930a2b2e8726774738f8 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 5 Dec 2018 14:48:16 -0500 Subject: [PATCH] Fix occasional NPE when players quit timed quests, fixes #559 --- src/main/java/me/blackvein/quests/PlayerListener.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/blackvein/quests/PlayerListener.java b/src/main/java/me/blackvein/quests/PlayerListener.java index cb90ed274..da7d8a2c0 100644 --- a/src/main/java/me/blackvein/quests/PlayerListener.java +++ b/src/main/java/me/blackvein/quests/PlayerListener.java @@ -701,8 +701,10 @@ public class PlayerListener implements Listener { } for (Integer timerId : quester.timers.keySet()) { plugin.getServer().getScheduler().cancelTask(timerId); - quester.timers.get(timerId).failQuest(quester); - quester.timers.remove(timerId); + if (quester.timers.containsKey(timerId)) { + quester.timers.get(timerId).failQuest(quester); + quester.timers.remove(timerId); + } } if (quester.hasData()) {