From 617b9475710b80a125597f222f9777224972ce72 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Fri, 21 Aug 2020 15:29:39 +0300 Subject: [PATCH] Fix NPE from flagTransform The bug affected loading of route graph connections about to be split in half when attached to diagram flags at either or both ends. The NPE caused the flag terminal position to receive identity transform as value which is plain wrong. This in turn resulted in the splitting position being completely wrong compared to what the user requested and the result looking very strange. This fixes the immediate problem but still doesn't work properly if the flag is actually attached to a diagram template flag table. In this case the terminal's position will be incorrectly calculated since runtimeDiagram is null. This needs another issue. gitlab #586 Change-Id: If09524c71c701f2c1190d0f915aafbb972c51da4 (cherry picked from commit 2526602db10c29f0c30c4a3cffaf33012d9c4a0e) --- .../src/org/simantics/diagram/function/All.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java index 6cd4c542f..5bb793f7d 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java @@ -95,6 +95,8 @@ public class All { Resource flag = context.element; Resource runtimeDiagram = context.runtime; + if (runtimeDiagram == null) + return flagTransformImpl(graph, converter, context); Resource diagram = graph.getPossibleObject(runtimeDiagram, DIA.RuntimeDiagram_HasConfiguration); if (diagram == null) -- 2.43.2