]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java
Don't assume that Element provides TerminalTopology
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / ElementUtils.java
index 300e74d31e75e04ee7ecf750ab0b2e58ba513951..465db5e934d7efe01fe5e5bae3778c9187a8f7c3 100644 (file)
@@ -258,8 +258,10 @@ public class ElementUtils {
     public static Collection<Terminal> getTerminals(IElement e, Collection<Terminal> result, boolean clearResult) {
         if (clearResult)
             result.clear();
-        TerminalTopology tt = e.getElementClass().getSingleItem(TerminalTopology.class);
-        tt.getTerminals(e, result);
+        TerminalTopology tt = e.getElementClass().getAtMostOneItemOfClass(TerminalTopology.class);
+        if (tt != null) {
+            tt.getTerminals(e, result);
+        }
         return result;
     }