forked from Fascinated/Bat
maybe fix a NPE??
This commit is contained in:
parent
048d2856f9
commit
35596b720b
@ -53,6 +53,11 @@ public class BatUser extends ProfileHolder {
|
||||
*/
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* The discord user associated with this user
|
||||
*/
|
||||
private User user;
|
||||
|
||||
public BatUser(@NonNull String id, @NonNull org.bson.Document document) {
|
||||
this.id = id;
|
||||
this.document = document;
|
||||
@ -61,6 +66,7 @@ public class BatUser extends ProfileHolder {
|
||||
|
||||
User user = DiscordService.JDA.getUserById(id);
|
||||
if (user != null) {
|
||||
this.user = user;
|
||||
this.globalName = user.getGlobalName();
|
||||
}
|
||||
}
|
||||
@ -78,7 +84,10 @@ public class BatUser extends ProfileHolder {
|
||||
* @return the guild
|
||||
*/
|
||||
public User getDiscordUser() {
|
||||
return DiscordService.JDA.getUserById(id);
|
||||
if (user == null) {
|
||||
user = DiscordService.JDA.getUserById(id);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user