From: Tuukka Lehtonen Date: Fri, 21 Aug 2020 12:29:39 +0000 (+0300) Subject: Fix NPE from flagTransform X-Git-Tag: v1.43.0~1 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F98%2F4398%2F1;p=simantics%2Fplatform.git 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 --- 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)