maybe fix npe??
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 40s

This commit is contained in:
Lee 2024-07-03 23:23:23 +01:00
parent 3878d3029b
commit bd9ac1e138

@ -49,11 +49,21 @@ public class BatGuild extends ProfileHolder {
*/
private Date createdAt;
/**
* The guild as the JDA Guild
*/
private Guild guild;
public BatGuild(@NonNull String id, @NonNull org.bson.Document document) {
this.id = id;
this.document = document;
boolean newAccount = this.document.isEmpty();
this.createdAt = newAccount ? new Date() : document.getDate("createdAt");
Guild guild = DiscordService.JDA.getGuildById(id);
if (guild != null) {
this.guild = guild;
}
}
/**
@ -71,7 +81,10 @@ public class BatGuild extends ProfileHolder {
* @return the guild
*/
public Guild getDiscordGuild() {
return DiscordService.JDA.getGuildById(id);
if (guild == null) {
guild = DiscordService.JDA.getGuildById(id);
}
return guild;
}
/**