Skip to content

Commit

Permalink
return an empty set rather than null, to avoid uses having to handle …
Browse files Browse the repository at this point in the history
…null
  • Loading branch information
juliandolby committed Feb 15, 2021
1 parent 90fe713 commit 7d84a0f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.ibm.wala.util.graph.NumberedNodeManager;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVector;
import com.ibm.wala.util.intset.EmptyIntSet;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntSet;
import java.io.Serializable;
Expand Down Expand Up @@ -129,7 +130,12 @@ public IntSet getSuccNodeNumbers(T node) throws IllegalArgumentException {
if (nodeManager.getNumber(node) < 0) {
throw new IllegalArgumentException("Node not in graph " + node);
}
return successors.getRelated(nodeManager.getNumber(node));
IntSet x = successors.getRelated(nodeManager.getNumber(node));
if (x == null) {
return EmptyIntSet.instance;
} else {
return x;
}
}

@Override
Expand Down

0 comments on commit 7d84a0f

Please sign in to comment.