From 6f8ba9e7f5c9d07c11f495d2f88f17dae4d6705f Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 7 Nov 2019 20:35:16 +0200 Subject: [PATCH] NPE fix for district scene graph nodes gitlab #63 Change-Id: Ie5902a9476d1ca516fb1a5c3e0af9ddc28f7b394 (cherry picked from commit 4d0c114c0f53694180f808747b63d64fcefb0932) --- .../district/network/ui/nodes/DistrictNetworkEdgeNode.java | 2 ++ .../district/network/ui/nodes/DistrictNetworkVertexNode.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java index 8c4af387..8f8c08e6 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeNode.java @@ -71,6 +71,8 @@ public class DistrictNetworkEdgeNode extends G2DParentNode implements ISelection if (t != null && !t.isIdentity()) { //ot = g2d.getTransform(); ot = (AffineTransform) g2d.getRenderingHint(G2DRenderingHints.KEY_TRANSFORM_UNDER_SPATIAL_ROOT); + if (ot == null) + ot = g2d.getTransform(); g2d.transform(t); if (scaleStroke) { AffineTransform work = DistrictNetworkNodeUtils.sharedTransform.get(); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java index 51ae30e0..1639d571 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkVertexNode.java @@ -67,6 +67,8 @@ public class DistrictNetworkVertexNode extends G2DParentNode implements ISelecti if (t != null && !t.isIdentity()) { //ot = g2d.getTransform(); ot = (AffineTransform) g2d.getRenderingHint(G2DRenderingHints.KEY_TRANSFORM_UNDER_SPATIAL_ROOT); + if (ot == null) + ot = g2d.getTransform(); g2d.transform(t); if (scaleStroke) { -- 2.47.1