Nullcheck user iteration in EssentialsTimer (fixes #675)

This commit is contained in:
vemacs 2016-06-25 09:47:06 -06:00
parent dabcb51034
commit 5cbcd7469b
1 changed files with 7 additions and 2 deletions

View File

@ -9,9 +9,9 @@ import java.util.logging.Level;
public class EssentialsTimer implements Runnable {
private final transient IEssentials ess;
private final transient Set<UUID> onlineUsers = new HashSet<UUID>();
private final transient Set<UUID> onlineUsers = new HashSet<>(); // Field is necessary for hidden users
private transient long lastPoll = System.nanoTime();
private final LinkedList<Double> history = new LinkedList<Double>();
private final LinkedList<Double> history = new LinkedList<>();
private int skip1 = 0;
private int skip2 = 0;
private final long maxTime = 10 * 1000000;
@ -76,6 +76,11 @@ public class EssentialsTimer implements Runnable {
}
}
final User user = ess.getUser(iterator.next());
// Not sure why this would happen, but it does
if (user == null) {
iterator.remove();
continue;
}
if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout()) {
if (!user.isHidden()) {
user.setLastLogout(user.getLastOnlineActivity());