From 36c4af35de3852c6038d3a62856d9b9378fb3939 Mon Sep 17 00:00:00 2001 From: Tux Date: Sat, 13 Dec 2014 23:42:44 -0500 Subject: [PATCH] Fix issues cleaning up after repeating tasks. A mass of NullPointerExceptions would be outputted when tasks were stopped. This is resolved by checking if we are still running (indicating a possible scheduler cancel) before telling the scheduler to pull the plug. Ideally, the entire BungeeCord scheduler should be rewritten. It has quite a few issues which could be avoided with a new system. --- .../main/java/net/md_5/bungee/scheduler/BungeeTask.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java index 033096d2..7e87ec13 100644 --- a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java +++ b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java @@ -76,6 +76,11 @@ public class BungeeTask implements Runnable, ScheduledTask } } - sched.cancel( this ); + // We might have been previously running before, but now we aren't. + // If we weren't already cancelled, then cancel ourselves. + if ( running.get() ) + { + sched.cancel( this ); + } } }