if (past && mounted.isReady() && mounted.getLinked().getShotsLeft()>0) {
if (past && (mounted != null) && (mounted.isReady()) && ((mounted.getLinked() == null) || (mounted.getLinked().getShotsLeft()>0))) {
    public int getNextWeapon(int start) {        boolean past = false;        for (Enumeration i = weaponList.elements(); i.hasMoreElements();) {            Mounted mounted = (Mounted)i.nextElement();            if (past && mounted.isReady() && mounted.getLinked().getShotsLeft()>0) {                return getEquipmentNum(mounted);            }            if (getEquipmentNum(mounted) == start) {                past = true;                continue;            }            if (past && getEquipmentNum(mounted)==start) {                return getFirstWeapon();            }        }        return getFirstWeapon();    }