test for null pointer exception

This commit is contained in:
Sebastien 2019-01-29 14:46:14 +01:00
parent 97ceb24a4d
commit 8088e5ffeb

View File

@ -60,6 +60,8 @@ 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());
logger.debug(userEntity);
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()){
logger.debug("Stats not found for " + userEntity.getName()); logger.debug("Stats not found for " + userEntity.getName());
User user = MainBot.jda.getUserById(userEntity.getJdaId()); User user = MainBot.jda.getUserById(userEntity.getJdaId());