Skip to content

Commit 7b738a8

Browse files
DanySKCopilot
andcommitted
Update alchemist-swingui/src/main/java/it/unibo/alchemist/boundary/swingui/monitor/impl/Generic2DDisplay.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 7490ac4 commit 7b738a8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

alchemist-swingui/src/main/java/it/unibo/alchemist/boundary/swingui/monitor/impl/Generic2DDisplay.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,12 @@ private void updateHookedNodeView() {
370370
if (hooked.isEmpty()) {
371371
return;
372372
}
373-
final P hookedCoordinates = positions.get(hooked.get());
373+
final Node<T> hookedNode = hooked.get();
374+
final P hookedCoordinates = positions.get(hookedNode);
375+
if (hookedCoordinates == null) {
376+
hooked.set(Optional.empty());
377+
return;
378+
}
374379
final Point hookedPoint = wormhole.getViewPoint(hookedCoordinates);
375380
if (hookedPoint.distance(getCenter()) > FREEDOM_RADIUS) {
376381
wormhole.setViewPosition(hookedPoint);

0 commit comments

Comments
 (0)