From c451ced35ae144dbe52d7f09d8eed128c9e644ee Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Fri, 15 Nov 2019 17:32:41 +0200 Subject: [PATCH] Previous change caused ClassCastExceptions. gitlab #26 Change-Id: I018a488b099be724828f636fe91e6d1e2903f3dc --- .../plant3d/utils/ComponentUtils.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java index 50ede807..939d1551 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java @@ -408,12 +408,18 @@ public class ComponentUtils { pipeRun.addChild(newComponent); - if (newComponent instanceof InlineComponent && ((InlineComponent)newComponent).isVariableLength() ||((InlineComponent)newComponent).isModifialble()) { - newPcp.setLength(inst.length); - newComponent.setParameter("length", inst.length); - } else if (newComponent instanceof TurnComponent && ((TurnComponent)newComponent).isVariableAngle()) { - newPcp.setTurnAngle(inst.angle); - newComponent.setParameter("turnAngle", inst.angle); + if (newComponent instanceof InlineComponent) { + InlineComponent inlineComponent = (InlineComponent)newComponent; + if (inlineComponent.isVariableLength()|| inlineComponent.isModifialble()) { + newPcp.setLength(inst.length); + newComponent.setParameter("length", inst.length); + } + } else if (newComponent instanceof TurnComponent) { + TurnComponent turnComponent = (TurnComponent)newComponent; + if (turnComponent.isVariableAngle()) { + newPcp.setTurnAngle(inst.angle); + newComponent.setParameter("turnAngle", inst.angle); + } } newComponent.updateParameters(); -- 2.47.1