Added a check in addPin()
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / GUIComponent.java
index 562f73a..13ec4a6 100644 (file)
@@ -84,6 +84,8 @@ public abstract class GUIComponent
         */
        protected void addPin(Pin pin)
        {
+               if (pin.component != this)
+                       throw new IllegalArgumentException("Can't add a pin not belonging to this component!");
                if (pinsByName.containsKey(pin.name))
                        throw new IllegalArgumentException("Duplicate pin name: " + pin.name);
                pinsByName.put(pin.name, pin);