Add null check in ignore command (#3226)

This would only become a problem if a server owner decided to delete a bunch of their userdata. Nonetheless, it doesn't hurt to have the check.

I promise this is the last pull request regarding this 😄
This commit is contained in:
Josh Roy 2020-05-04 09:17:08 -04:00 committed by GitHub
parent dd5fe117b5
commit fd136384a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,10 @@ public class Commandignore extends EssentialsCommand {
if (args.length < 1) {
StringBuilder sb = new StringBuilder();
for (UUID uuid : user._getIgnoredPlayers()) {
sb.append(ess.getUser(uuid).getName()).append(" ");
User curUser = ess.getUser(uuid);
if (curUser != null && curUser.getName() != null && !curUser.getName().trim().equals("")) {
sb.append(curUser.getName()).append(" ");
}
}
String ignoredList = sb.toString().trim();
user.sendMessage(ignoredList.length() > 0 ? tl("ignoredList", ignoredList) : tl("noIgnored"));