#fixed code
                                public int countWatches() {

        if (watchedConstraints == null)
            return 0;

        int count = 0;

        for (HashSet<Constraint> c : watchedConstraints.values())
            count += c.size();

        return count;

    }
#vulnerable code 
                                public int countWatches() {

        if (watchedConstraints == null)
            return 0;

        int count = 0;

        for (Var v : watchedConstraints.keySet())
            count += watchedConstraints.get(v).size();

        return count;

    } 
                            #location 9 
                            #vulnerability type NULL_DEREFERENCE