From: Daniel Kirschten Date: Sat, 22 Jun 2019 08:31:11 +0000 (+0200) Subject: Added a check in addPin() X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=d4a8686ac030c6fca1f3f742cb7322f7181d3085;p=Mograsim.git Added a check in addPin() --- diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java index 562f73a4..13ec4a60 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java @@ -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);