Fixed yet another potential NPE. 31/1531/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 7 Mar 2018 10:50:28 +0000 (12:50 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 7 Mar 2018 10:50:28 +0000 (12:50 +0200)
refs #7800

Change-Id: Ia6f45c5f3b5c32845bb486062fe46e10fe8cffe2

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java

index 604faa69ed63d99f944bfabac8686eea2437750f..84cefe37fc47eff3fba167a7c3366e0f0eabb3ad 100644 (file)
@@ -609,7 +609,7 @@ public class All {
                        Variable parent = context.getParent(graph);
                        Resource container = parent.getPossibleRepresents(graph);
                        if(container == null)
-                           return null;
+                               return null;
                        Map<String,Resource> methods = graph.syncRequest(new UnescapedMethodMapOfResource(container));
                        Resource predicate = methods.get(name);
                        if(predicate != null) {
@@ -625,6 +625,8 @@ public class All {
                public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {
                        Variable parent = context.getParent(graph);
                        Resource container = parent.getPossibleRepresents(graph);
+                       if(container == null)
+                               return Collections.emptyMap();
                        Map<String,Resource> methods = graph.syncRequest(new UnescapedMethodMapOfResource(container));
                        for(Map.Entry<String, Resource> entry : methods.entrySet()) {
                                String name = entry.getKey();