Still try to correct null pointer

This commit is contained in:
Sebastien 2019-01-29 15:05:22 +01:00
parent 205f6498f2
commit e3353411bd

View File

@ -194,12 +194,15 @@ public class UserStatsUtils {
List<UserStats> allStats = userStatsRepository.findByGuildId(guildId);
List<GuildStats> ranked = new ArrayList<>();
for(UserStats stats : allStats){
String avatar = MainBot.jda.getUserById(stats.getUser().getJdaId()).getEffectiveAvatarUrl();
GuildStats temp = new GuildStats(stats.getUser().getName(), 0, avatar, stats.getVocalTime(), stats.getMessageCount(), stats.getApiCommandCount());
if(stats.getUser().getId().equals(userEntity.getId())){
selfGuildStats = temp;
if(stats != null){
String avatar = MainBot.jda.getUserById(stats.getUser().getJdaId()).getEffectiveAvatarUrl();
GuildStats temp = new GuildStats(stats.getUser().getName(), 0, avatar, stats.getVocalTime(), stats.getMessageCount(), stats.getApiCommandCount());
if(stats.getUser().getId().equals(userEntity.getId())){
selfGuildStats = temp;
}
ranked.add(temp);
}
ranked.add(temp);
}
ranked.sort((guildStats, t1) -> (int) (t1.total - guildStats.total));