]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Added null check after getPossibleType(STR.Component)" into release/1.35.1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 25 Feb 2019 10:00:23 +0000 (10:00 +0000)
committerGerrit Code Review <gerrit2@simantics>
Mon, 25 Feb 2019 10:00:23 +0000 (10:00 +0000)
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/ConnectionPointNameStyle.java
bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/SyncTypicalTemplatesToInstances.java

index a4f32e81139a5f22d699af3e7d15a5ee7ba3578b..d86925e485d187ef8d48e25535a091ffbcb5facd 100644 (file)
@@ -159,8 +159,8 @@ public class ConnectionPointNameStyle extends StyleBase<List<ConnectionPointName
         // always clean up old items before drawing new items
         cleanupStyleForNode(_node);
 
-        int count = resultList.size();
-        if (resultList == null || count < 2)
+        int count = resultList != null ? resultList.size() : 0;
+        if (count < 2)
             return;
 
         G2DParentNode parentNode = ProfileVariables.claimChild(_node, "", PARENT_NODE_NAME_PREFIX, G2DParentNode.class, observer);
index 7c1fe461a5e14218991f87224c8ec1d47e42a16e..8a0b1ddbca77e0f81fd283d8445c715e8c2e5adb 100644 (file)
@@ -459,6 +459,8 @@ public class SyncTypicalTemplatesToInstances extends WriteRequest {
     private boolean isSynchronizedConnector(ReadGraph graph, Resource templateConnection, Resource instanceConnector) throws DatabaseException {
        DiagramResource DIA = DiagramResource.getInstance(graph);
        Resource instanceConnection = graph.getPossibleObject(instanceConnector, DIA.IsConnectorOf);
+       if (instanceConnection == null)
+               return false;
        return graph.hasStatement(instanceConnection, MOD.HasElementSource, templateConnection)
                        // If the master connection has been removed, this is all that's left
                        // to identify a connection that at least was originally synchronized