From: jjenista <jjenista> Date: Wed, 4 Mar 2009 00:02:51 +0000 (+0000) Subject: Return empty sets instead of null X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4d66ef589058bdfe0ba215107c0fc841a81aa385;p=IRC.git Return empty sets instead of null --- diff --git a/Robust/src/Analysis/CallGraph/CallGraph.java b/Robust/src/Analysis/CallGraph/CallGraph.java index ee148c81..7b011300 100644 --- a/Robust/src/Analysis/CallGraph/CallGraph.java +++ b/Robust/src/Analysis/CallGraph/CallGraph.java @@ -37,7 +37,12 @@ public class CallGraph { // (MethodDescriptors and/or TaskDescriptors) // that call the given method public Set getCallerSet(MethodDescriptor md) { - return (Set) mapCallee2CallerSet.get(md); + Set s = (Set) mapCallee2CallerSet.get(md); + + if( s == null ) { + return new HashSet(); + } + return s; } // this method returns the set of MethodDescriptors that @@ -46,7 +51,12 @@ public class CallGraph { assert(d instanceof MethodDescriptor) || (d instanceof TaskDescriptor); - return (Set) mapCaller2CalleeSet.get(d); + Set s = (Set) mapCaller2CalleeSet.get(d); + + if( s == null ) { + return new HashSet(); + } + return s; } // build a mapping of virtual methods to all