From 0f307eb18c51cf567fdfaaec56b57abf56bbddc6 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 1 Aug 2024 23:48:45 +0100 Subject: [PATCH] api: oopsie again --- API/src/main/java/cc/fascinated/model/user/User.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/API/src/main/java/cc/fascinated/model/user/User.java b/API/src/main/java/cc/fascinated/model/user/User.java index 3908c93..0ea68c8 100644 --- a/API/src/main/java/cc/fascinated/model/user/User.java +++ b/API/src/main/java/cc/fascinated/model/user/User.java @@ -74,7 +74,10 @@ public class User { * @return the statistics */ public Map getStatistics(@NonNull Platform.Platforms platform) { - return statistics.computeIfAbsent(platform, k -> new HashMap<>()); + if (this.statistics == null) { + this.statistics = new HashMap<>(); + } + return this.statistics.computeIfAbsent(platform, k -> new HashMap<>()); } /** @@ -85,6 +88,6 @@ public class User { * @param statistic the statistic to add */ public void addStatistic(@NonNull Platform.Platforms platform, @NonNull Date date, @NonNull Statistic statistic) { - getStatistics(platform).put(date, statistic); + this.getStatistics(platform).put(date, statistic); } }