From 4d66ef589058bdfe0ba215107c0fc841a81aa385 Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 4 Mar 2009 00:02:51 +0000 Subject: [PATCH] Return empty sets instead of null --- Robust/src/Analysis/CallGraph/CallGraph.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 -- 2.34.1