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);