From: Marko Luukkainen Date: Fri, 15 Nov 2019 15:32:41 +0000 (+0200) Subject: Previous change caused ClassCastExceptions. X-Git-Tag: v1.43.0~120 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=8f71b333e7b1d116e55c2d39054aeb90dd93028d;p=simantics%2F3d.git Previous change caused ClassCastExceptions. gitlab #26 Change-Id: I018a488b099be724828f636fe91e6d1e2903f3dc (cherry picked from commit c451ced35ae144dbe52d7f09d8eed128c9e644ee) --- 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();