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;h=55b6b41a94961d0c19ce7dcd784f287a3592064f;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);