mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-01 00:10:12 +01:00
Added a couple null checks in an attempt to fix #26
Cause for NPE still unknown
This commit is contained in:
parent
814f6771a8
commit
a820da3261
@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -151,11 +152,16 @@ public class UserData {
|
||||
}
|
||||
|
||||
public void addSession(SessionData session) {
|
||||
sessions.add(session);
|
||||
if (session != null) {
|
||||
sessions.add(session);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSessions(Collection<SessionData> sessions) {
|
||||
this.sessions.addAll(sessions);
|
||||
Collection<SessionData> filteredSessions = sessions.parallelStream()
|
||||
.filter(session -> session != null)
|
||||
.collect(Collectors.toList());
|
||||
this.sessions.addAll(filteredSessions);
|
||||
}
|
||||
|
||||
public void setCurrentSession(SessionData session) {
|
||||
|
@ -24,6 +24,7 @@ public class PlayerActivityGraphCreator {
|
||||
CopyOnWriteArrayList<Long> sessionEnds = new CopyOnWriteArrayList<>();
|
||||
CopyOnWriteArrayList<SessionData> s = new CopyOnWriteArrayList(sessionData);
|
||||
s.parallelStream()
|
||||
.filter(session -> (session != null))
|
||||
.filter((session) -> (session.getSessionStart() > nowMinusScale))
|
||||
.forEach((session) -> {
|
||||
sessionEnds.add(session.getSessionEnd());
|
||||
|
Loading…
Reference in New Issue
Block a user