diff --git a/com.ibm.wala.core/src/com/ibm/wala/demandpa/alg/DemandRefinementPointsTo.java b/com.ibm.wala.core/src/com/ibm/wala/demandpa/alg/DemandRefinementPointsTo.java index f794680a8..b4e868da1 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/demandpa/alg/DemandRefinementPointsTo.java +++ b/com.ibm.wala.core/src/com/ibm/wala/demandpa/alg/DemandRefinementPointsTo.java @@ -256,7 +256,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo { throws IllegalArgumentException { Pair> p = getPointsToWithStates(pk, ikeyPred); final Collection p2SetWithStates = p.snd; - Collection finalP2Set = removeStates(p2SetWithStates); + Collection finalP2Set = p2SetWithStates != null ? removeStates(p2SetWithStates) : Collections.emptySet(); return Pair.make(p.fst, finalP2Set); } @@ -283,6 +283,9 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo { * Unwrap a Collection of WithState objects, returning a Collection containing the wrapped objects */ private static Collection removeStates(final Collection> p2SetWithStates) { + if (p2SetWithStates == null) { + throw new IllegalArgumentException("p2SetWithStates == null"); + } Collection finalP2Set = Iterator2Collection.toSet(new MapIterator, T>(p2SetWithStates.iterator(), new Function, T>() {