DGP - added isCompatible checks for all Rocksim components
[debian/openrocket] / src / net / sf / openrocket / file / rocksim / InnerBodyTubeHandler.java
index 1c7b41c2157d6725a4daa9c20d0db486dc8d073d..eaa10148bdf54019d5eb46c0755a11096d0fe7e6 100644 (file)
@@ -27,14 +27,17 @@ class InnerBodyTubeHandler extends PositionDependentHandler<InnerTube> {
      * Constructor.
      *
      * @param c the parent component
+     * @param warnings  the warning set
      * @throws IllegalArgumentException thrown if <code>c</code> is null
      */
-    public InnerBodyTubeHandler(RocketComponent c) throws IllegalArgumentException {
+    public InnerBodyTubeHandler(RocketComponent c, WarningSet warnings) throws IllegalArgumentException {
         if (c == null) {
             throw new IllegalArgumentException("The parent component of an inner tube may not be null.");
         }
         bodyTube = new InnerTube();
-        c.addChild(bodyTube);
+        if (isCompatible(c, InnerTube.class, warnings)) {
+            c.addChild(bodyTube);
+        }
     }
 
     @Override