forked from Fascinated/Bat
fix user leaving guild npe
This commit is contained in:
@ -38,10 +38,10 @@ public abstract class ProfileHolder {
|
||||
Serializable profile = getProfiles().get(clazz.getSimpleName());
|
||||
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 = profiles.isEmpty() ? new org.bson.Document() : profiles.get(clazz.getSimpleName(), new org.bson.Document());
|
||||
Document profiles = document.get("profiles", new org.bson.Document());
|
||||
Document profileDocument = (Document) profiles.get(clazz.getSimpleName());
|
||||
|
||||
newProfile.load(profileDocument, BatApplication.GSON);
|
||||
newProfile.load(profileDocument == null ? new Document() : profileDocument, BatApplication.GSON);
|
||||
getProfiles().put(clazz.getSimpleName(), newProfile);
|
||||
return newProfile;
|
||||
}
|
||||
|
Reference in New Issue
Block a user