From 9183bde51ec037fe6c1db466d9afc7c4f49020c9 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sat, 29 Jul 2023 23:13:07 +0200 Subject: [PATCH] [#2276] Don't check for inline if grandparent is this component This was a sneaky bug... Basically, if getAutoRadius was called on e.g. a body tube, which eventually ended in the `inline` call, and candidate.parent.parent was this component, then the getRadius method would cause an infinite loop (stackoverflow), because it calls getAutoRadius --- .../net/sf/openrocket/rocketcomponent/SymmetricComponent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/SymmetricComponent.java b/core/src/net/sf/openrocket/rocketcomponent/SymmetricComponent.java index cb3883857..a5873f267 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/SymmetricComponent.java +++ b/core/src/net/sf/openrocket/rocketcomponent/SymmetricComponent.java @@ -852,8 +852,8 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou (!MathUtil.equals(this.parent.getRadiusMethod().getRadius(this.parent.parent, this, this.parent.getRadiusOffset()), 0))) return false; - if ((candidate.parent instanceof RingInstanceable) && - (!MathUtil.equals(candidate.parent.getRadiusMethod().getRadius(candidate.parent.parent, candidate, candidate.parent.getRadiusOffset()), 0))) + if ((candidate.parent instanceof RingInstanceable) && ((candidate.parent.parent == this) || + (!MathUtil.equals(candidate.parent.getRadiusMethod().getRadius(candidate.parent.parent, candidate, candidate.parent.getRadiusOffset()), 0)))) return false; return true;