Fix occasional NPE when players quit timed quests, fixes #559

This commit is contained in:
BuildTools 2018-12-05 14:48:16 -05:00
parent c77becce48
commit 99d4598c16

View File

@ -701,8 +701,10 @@ public class PlayerListener implements Listener {
} }
for (Integer timerId : quester.timers.keySet()) { for (Integer timerId : quester.timers.keySet()) {
plugin.getServer().getScheduler().cancelTask(timerId); plugin.getServer().getScheduler().cancelTask(timerId);
quester.timers.get(timerId).failQuest(quester); if (quester.timers.containsKey(timerId)) {
quester.timers.remove(timerId); quester.timers.get(timerId).failQuest(quester);
quester.timers.remove(timerId);
}
} }
if (quester.hasData()) { if (quester.hasData()) {