From: jkauttio Date: Fri, 15 Aug 2014 07:59:49 +0000 (+0000) Subject: Add checks for null terminals to new connection metadata creation X-Git-Tag: v1.29.0~231 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=0ac86304ec07c3ae955b9f0deb91b5d00a3816fd;p=simantics%2Fsysdyn.git Add checks for null terminals to new connection metadata creation fixes #5119 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30072 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java index e4467d9f..9f2ebcad 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java @@ -67,9 +67,6 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{ public void create(WriteGraph graph, ConnectionJudgement judgment, Deque controlPoints, TerminalInfo startTerminal, TerminalInfo endTerminal) throws DatabaseException { - if(startTerminal == null) return; - if(endTerminal == null) return; - graph.markUndoPoint(); // If needs a valve, we will create two separate connections @@ -81,11 +78,12 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{ createConnection(graph, judgment, controlPoints, startTerminal, endTerminal, false); } - String startElementName = startTerminal.e.getHint(ElementHints.KEY_TEXT); - String endElementName = endTerminal.e.getHint(ElementHints.KEY_TEXT); - String startElementResource = startTerminal.e.getHint(ElementHints.KEY_OBJECT).toString(); - String endElementResource = endTerminal.e.getHint(ElementHints.KEY_OBJECT).toString(); + String startElementName = startTerminal != null ? startTerminal.e.getHint(ElementHints.KEY_TEXT).toString() : "null"; + String endElementName = endTerminal != null ? endTerminal.e.getHint(ElementHints.KEY_TEXT).toString() : "null"; + + String startElementResource = startTerminal != null ? startTerminal.e.getHint(ElementHints.KEY_OBJECT).toString() : "null"; + String endElementResource = endTerminal != null ? endTerminal.e.getHint(ElementHints.KEY_OBJECT).toString() : "null"; Layer0Utils.addCommentMetadata(graph, "Created dependency starting from " + startElementName + " " + startElementResource + " and ending to " + endElementName + " " + endElementResource); }