Added a check in addPin()
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 22 Jun 2019 08:31:11 +0000 (10:31 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 22 Jun 2019 08:31:11 +0000 (10:31 +0200)
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);