if (colorUsed[player.getColorIndex()]) {
if (null != player && colorUsed[player.getColorIndex()]) {
    public void validatePlayerInfo(int playerId) {        final Player player = getPlayer(playerId);                //        maybe this isn't actually useful        //        // replace characters we don't like with "X"        //        StringBuffer nameBuff = new StringBuffer(player.getName());        //        for (int i = 0; i < nameBuff.length(); i++) {        //            int chr = nameBuff.charAt(i);        //            if (LEGAL_CHARS.indexOf(chr) == -1) {        //                nameBuff.setCharAt(i, 'X');        //            }        //        }        //        player.setName(nameBuff.toString());                //TODO: check for duplicate or reserved names                // make sure colorIndex is unique        boolean[] colorUsed = new boolean[Player.colorNames.length];        for (Enumeration i = game.getPlayers(); i.hasMoreElements();) {            final Player otherPlayer = (Player)i.nextElement();            if (otherPlayer.getId() != playerId) {                colorUsed[otherPlayer.getColorIndex()] = true;            }        }        if (colorUsed[player.getColorIndex()]) {            // find a replacement color;            for (int i = 0; i < colorUsed.length; i++) {                if (!colorUsed[i]) {                    player.setColorIndex(i);                    break;                }            }        }            }