Added handling for potential null strings in "territoryNeutralDenyCommands" and "territoryEnemyDenyCommands"

This commit is contained in:
Brettflan 2011-08-05 14:06:35 -05:00
parent ce7fa7fae4
commit b45224fff0

View File

@ -434,7 +434,12 @@ public class FactionsPlayerListener extends PlayerListener{
Iterator<String> iter = Conf.territoryNeutralDenyCommands.iterator(); Iterator<String> iter = Conf.territoryNeutralDenyCommands.iterator();
String cmdCheck; String cmdCheck;
while (iter.hasNext()) { while (iter.hasNext()) {
cmdCheck = iter.next().toLowerCase(); cmdCheck = iter.next();
if (cmdCheck == null) {
continue;
}
cmdCheck = cmdCheck.toLowerCase();
if (fullCmd.startsWith(cmdCheck) || shortCmd.startsWith(cmdCheck)) { if (fullCmd.startsWith(cmdCheck) || shortCmd.startsWith(cmdCheck)) {
me.sendMessage("You can't use the command \""+fullCmd+"\" in neutral territory."); me.sendMessage("You can't use the command \""+fullCmd+"\" in neutral territory.");
return true; return true;
@ -449,7 +454,12 @@ public class FactionsPlayerListener extends PlayerListener{
Iterator<String> iter = Conf.territoryEnemyDenyCommands.iterator(); Iterator<String> iter = Conf.territoryEnemyDenyCommands.iterator();
String cmdCheck; String cmdCheck;
while (iter.hasNext()) { while (iter.hasNext()) {
cmdCheck = iter.next().toLowerCase(); cmdCheck = iter.next();
if (cmdCheck == null) {
continue;
}
cmdCheck = cmdCheck.toLowerCase();
if (fullCmd.startsWith(cmdCheck) || shortCmd.startsWith(cmdCheck)) { if (fullCmd.startsWith(cmdCheck) || shortCmd.startsWith(cmdCheck)) {
me.sendMessage("You can't use the command \""+fullCmd+"\" in enemy territory."); me.sendMessage("You can't use the command \""+fullCmd+"\" in enemy territory.");
return true; return true;