]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix NPE from flagTransform 63/4363/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 21 Aug 2020 12:29:39 +0000 (15:29 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 21 Aug 2020 13:23:46 +0000 (13:23 +0000)
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)

bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java

index 6cd4c542f106afe53d4d80a774f4e9ace4e90e28..5bb793f7df39b6147ce72511d48664d9ba94ec95 100644 (file)
@@ -95,6 +95,8 @@ public class All {
 
                Resource flag = context.element;
                Resource runtimeDiagram = context.runtime;
 
                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)
 
                Resource diagram = graph.getPossibleObject(runtimeDiagram, DIA.RuntimeDiagram_HasConfiguration);
                if (diagram == null)