if (!m.isDestroyed() && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("On")) {
if (!m.isDestroyed() && m.getType() instanceof MiscType && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("On")) {
    public boolean hasActiveMASC() {        for (Enumeration e = getEquipment(); e.hasMoreElements(); ) {            Mounted m = (Mounted)e.nextElement();            if (!m.isDestroyed() && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("On")) {                return true;            }        }        return false;    }