]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Add checks for null terminals to new connection metadata creation
authorjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 15 Aug 2014 07:59:49 +0000 (07:59 +0000)
committerjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 15 Aug 2014 07:59:49 +0000 (07:59 +0000)
fixes #5119

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30072 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java

index e4467d9f3840f0737a1afa1ba60602ff221f6395..9f2ebcad6394344ec3bb6ba935e5282c8fdec2e5 100644 (file)
@@ -67,9 +67,6 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{
     public void create(WriteGraph graph, ConnectionJudgement judgment, Deque<ControlPoint> controlPoints,\r
             TerminalInfo startTerminal, TerminalInfo endTerminal) throws DatabaseException {\r
 \r
-       if(startTerminal == null) return;\r
-       if(endTerminal == null) return;\r
-        \r
         graph.markUndoPoint();\r
         \r
        // If needs a valve, we will create two separate connections\r
@@ -81,11 +78,12 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{
                createConnection(graph, judgment, controlPoints, startTerminal, endTerminal, false);\r
         }\r
         \r
-        String startElementName = startTerminal.e.getHint(ElementHints.KEY_TEXT);\r
-        String endElementName = endTerminal.e.getHint(ElementHints.KEY_TEXT);\r
         \r
-        String startElementResource = startTerminal.e.getHint(ElementHints.KEY_OBJECT).toString();\r
-        String endElementResource = endTerminal.e.getHint(ElementHints.KEY_OBJECT).toString();\r
+        String startElementName = startTerminal != null ? startTerminal.e.getHint(ElementHints.KEY_TEXT).toString() : "null";\r
+        String endElementName = endTerminal != null ? endTerminal.e.getHint(ElementHints.KEY_TEXT).toString() : "null";\r
+        \r
+        String startElementResource = startTerminal != null ? startTerminal.e.getHint(ElementHints.KEY_OBJECT).toString() : "null";\r
+        String endElementResource = endTerminal != null ? endTerminal.e.getHint(ElementHints.KEY_OBJECT).toString() : "null";\r
         \r
         Layer0Utils.addCommentMetadata(graph, "Created dependency starting from " + startElementName + " " + startElementResource + " and ending to " + endElementName + " " + endElementResource);\r
     }\r