From c93e112ebf1a17273db838702b3107c11be5e388 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 1 Jul 2024 15:14:42 +0100 Subject: [PATCH] might fix, who knows --- src/main/java/cc/fascinated/bat/common/ProfileHolder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/common/ProfileHolder.java b/src/main/java/cc/fascinated/bat/common/ProfileHolder.java index 8def165..21a6e39 100644 --- a/src/main/java/cc/fascinated/bat/common/ProfileHolder.java +++ b/src/main/java/cc/fascinated/bat/common/ProfileHolder.java @@ -39,7 +39,7 @@ public abstract class ProfileHolder { if (profile == null) { T newProfile = clazz.cast(clazz.getDeclaredConstructors()[0].newInstance()); org.bson.Document profiles = document.get("profiles", new org.bson.Document()); - org.bson.Document profileDocument = (org.bson.Document) profiles.getOrDefault(clazz.getSimpleName(), new org.bson.Document()); + org.bson.Document profileDocument = profiles.isEmpty() ? new org.bson.Document() : profiles.get(clazz.getSimpleName(), new org.bson.Document()); newProfile.load(profileDocument, BatApplication.GSON); getProfiles().put(clazz.getSimpleName(), newProfile);