From: Tuukka Lehtonen Date: Thu, 7 Nov 2019 18:35:16 +0000 (+0200) Subject: NPE fix for district scene graph nodes X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=4d0c114c0f53694180f808747b63d64fcefb0932;p=simantics%2Fdistrict.git NPE fix for district scene graph nodes gitlab #63 Change-Id: Ie5902a9476d1ca516fb1a5c3e0af9ddc28f7b394 --- 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) {