From 2ba8ab087bfd1747a52dded615ed7bde69d92a04 Mon Sep 17 00:00:00 2001 From: Niklas Rentz Date: Fri, 5 Apr 2024 13:15:45 +0200 Subject: [PATCH] fixed same issue when recursing through edges with targets within non-expanded nodes. Added a check to avoid further NPEs at this place. --- .../klighd/lsp/utils/RenderingPreparer.xtend | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/RenderingPreparer.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/RenderingPreparer.xtend index f9f40135d..6a3f8c20f 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/RenderingPreparer.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/RenderingPreparer.xtend @@ -142,7 +142,10 @@ final class RenderingPreparer { } } for (edge : element.outgoingEdges) { - prepareRendering(edge, kGraphToSGraph) + // not expanded => edge must not have the target node inside the non-expanded + if (isExpanded || !KGraphUtil.isDescendant(edge.target, element)) { + prepareRendering(edge, kGraphToSGraph) + } } for (port : element.ports) { prepareRendering(port, kGraphToSGraph) @@ -382,10 +385,11 @@ final class RenderingPreparer { var List pointList = new ArrayList() if (parent instanceof KEdge) { val edge = parent as KEdge - - pointList.add(new Point2D.Float(edge.sourcePoint.x, edge.sourcePoint.y)) - pointList.addAll(edge.bendPoints.map[ new Point2D.Float(it.x, it.y) ]) - pointList.add(new Point2D.Float(edge.targetPoint.x, edge.targetPoint.y)) + if (edge.sourcePoint !== null && edge.targetPoint !== null) { + pointList.add(new Point2D.Float(edge.sourcePoint.x, edge.sourcePoint.y)) + pointList.addAll(edge.bendPoints.map[ new Point2D.Float(it.x, it.y) ]) + pointList.add(new Point2D.Float(edge.targetPoint.x, edge.targetPoint.y)) + } } else if (!parentRendering.points.empty) { pointList.addAll(parentRendering.points.map[position | PlacementUtil.evaluateKPosition(position, parentBounds, true).toPoint2D])