Quick fix for null pointer

This commit is contained in:
Sebastien 2019-01-29 14:56:56 +01:00
parent 797988feae
commit 205f6498f2

View File

@ -60,6 +60,10 @@ public class UserStatsUtils {
public List<UserStats> getUserStats(UserEntity userEntity){ public List<UserStats> getUserStats(UserEntity userEntity){
User jdaUser = MainBot.jda.getUserById(userEntity.getJdaId()); User jdaUser = MainBot.jda.getUserById(userEntity.getJdaId());
//TODO clean database for deleted users
if(jdaUser == null)
return null;
logger.debug(userEntity); logger.debug(userEntity);
logger.debug(userEntity.getUserStats()); logger.debug(userEntity.getUserStats());
if(userEntity.getUserStats() == null || userEntity.getUserStats().size() == 0 || userEntity.getUserStats().size() < jdaUser.getMutualGuilds().size()){ if(userEntity.getUserStats() == null || userEntity.getUserStats().size() == 0 || userEntity.getUserStats().size() < jdaUser.getMutualGuilds().size()){