diff --git a/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java b/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java index fbfd20b..0708a87 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java +++ b/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java @@ -64,7 +64,7 @@ public class MemberListener implements EventListener { @Override public void onGuildMemberLeave(@NonNull BatGuild guild, BatUser user, @NonNull GuildMemberRemoveEvent event) { - if (user.getDiscordUser().isBot()) return; + if (user == null || user.getDiscordUser().isBot()) return; log.info("User \"{}\" left the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName()); logFeature.sendLog(guild, LogType.MEMBER_LEAVE, EmbedUtils.errorEmbed() diff --git a/src/main/java/cc/fascinated/bat/service/MongoService.java b/src/main/java/cc/fascinated/bat/service/MongoService.java index 93260bb..d1a8736 100644 --- a/src/main/java/cc/fascinated/bat/service/MongoService.java +++ b/src/main/java/cc/fascinated/bat/service/MongoService.java @@ -12,12 +12,12 @@ import org.springframework.stereotype.Service; @Service public class MongoService { public static MongoService INSTANCE; - private final MongoTemplate mongo; + private final MongoTemplate mongoTemplate; @Autowired public MongoService(MongoTemplate mongo) { INSTANCE = this; - this.mongo = mongo; + this.mongoTemplate = mongo; } /** @@ -26,7 +26,7 @@ public class MongoService { * @return The guilds collection */ public MongoCollection getGuildsCollection() { - return mongo.getCollection("guilds"); + return mongoTemplate.getCollection("guilds"); } /** @@ -35,6 +35,6 @@ public class MongoService { * @return The users collection */ public MongoCollection getUsersCollection() { - return mongo.getCollection("users"); + return mongoTemplate.getCollection("users"); } }