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=f3ef9a88f1df491ec37253d0539e4ad6136724c2;hb=53e2bb4363368cc84b12da42bdd228d69b2aca9b;hp=7fe6e432db22d829fb412c024fd43cf60a6b3443;hpb=a25f554756e1bc9a1f842293aefe60a220d8b950;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 7fe6e432..f3ef9a88 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 @@ -122,7 +122,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) @@ -217,11 +217,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)