From 0a25c5702b8ef9ced0338ba3d5288b4640a2f5c1 Mon Sep 17 00:00:00 2001 From: Jussi Koskela Date: Wed, 7 Nov 2018 15:52:57 +0200 Subject: [PATCH] Don't assume that Element provides TerminalTopology --- .../src/org/simantics/g2d/element/ElementUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java index 300e74d31..465db5e93 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java @@ -258,8 +258,10 @@ public class ElementUtils { public static Collection getTerminals(IElement e, Collection 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; } -- 2.47.1