Fix NPE when mute list is empty

This commit is contained in:
Marco Cunha committed 2012-08-25 00:10:03 +02:00
1 parent 39b429c370
commit d929a5be71
1 file changed
+4 -1
@@ -83,9 +83,11 @@ public class MuteListCommand implements CommandExecutor {
// TODO Support paging through this list // TODO Support paging through this list
int count = 0; int count = 0;
String players = "";
if (chan.hasMuteList()) {
Iterator<String> iter = chan.getMuteList().iterator(); Iterator<String> iter = chan.getMuteList().iterator();
boolean first = true; boolean first = true;
String players = "";
while(iter.hasNext()) { while(iter.hasNext()) {
if (!first) { if (!first) {
players += Colors.Green + ", "+ Colors.White; players += Colors.Green + ", "+ Colors.White;
@@ -93,6 +95,7 @@ public class MuteListCommand implements CommandExecutor {
players += iter.next(); players += iter.next();
count++; count++;
} }
}
if (count == 0) { if (count == 0) {
TownyMessaging.sendMsg(sender, "[TownyChat] There are no muted playeers in " + Colors.White + chan.getName()); TownyMessaging.sendMsg(sender, "[TownyChat] There are no muted playeers in " + Colors.White + chan.getName());