X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.editor%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Feditor%2Fhandles%2FHandleManager.java;h=ee755f92b935aca80f9fdb3576d5375e4b2d0bb1;hb=d43a60248809b835d63a7f8cc50a3346902e790e;hp=7e2316079adaa4053d3b63bdb94d22ecd2132b66;hpb=dd7a333174bd23e62b6d16d3ae4eb1e5f6f8c5d5;p=Mograsim.git diff --git a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java index 7e231607..ee755f92 100644 --- a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java +++ b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java @@ -121,7 +121,7 @@ public class HandleManager { Point[] newPath = w.getPath(); int newLength = newPath == null ? 0 : newPath.length; - int diff = oldLength.getAndSet(newLength) - newLength; + int diff = newLength - oldLength.getAndSet(newLength); if (diff != 0) { if (diff > 0) @@ -216,11 +216,14 @@ public class HandleManager void destroyWirePointHandle(GUIWire owner, WirePointHandle h) { - List handles = pointHandlesPerWire.get(owner); - int pointIndex = handles.indexOf(h); - handles.remove(pointIndex); - removeHandle(h); - owner.removePathPoint(pointIndex); + if (pointHandlesPerWire.containsKey(owner)) + { + List handles = pointHandlesPerWire.get(owner); + int pointIndex = handles.indexOf(h); + handles.remove(pointIndex); + removeHandle(h); + owner.removePathPoint(pointIndex); + } } private void removeWirePointHandles(GUIWire owner)