Return empty sets instead of null
authorjjenista <jjenista>
Wed, 4 Mar 2009 00:02:51 +0000 (00:02 +0000)
committerjjenista <jjenista>
Wed, 4 Mar 2009 00:02:51 +0000 (00:02 +0000)
Robust/src/Analysis/CallGraph/CallGraph.java

index ee148c8167bc9e75e1bfedb8d89f87a30fcc8cfb..7b011300b94f820338b4e645538c36fa41d67382 100644 (file)
@@ -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