From: Jussi Koskela Date: Wed, 7 Nov 2018 13:52:57 +0000 (+0200) Subject: Don't assume that Element provides TerminalTopology X-Git-Tag: v1.43.0~136^2~273 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=27f08248fa2471dab6bce315387b9617fcfeb1ea;p=simantics%2Fplatform.git Don't assume that Element provides TerminalTopology (cherry picked from commit c0940268d6e3551f5c700d677073bf754ce8eaad) --- 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; }