From f366bd2c87748ab72cb42f468cd1e72e1a1c9b6c Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Fri, 3 Mar 2017 09:33:57 +0200 Subject: [PATCH] Prevent NPE when comparing a node that is still without parent. refs #7062 Change-Id: I13990a8db66408c1bc3cab6e4da8ba7997220c1a --- .../src/org/simantics/g2d/element/ElementUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java index 1a12210f0..749343217 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java @@ -1162,7 +1162,7 @@ public class ElementUtils { // If the previously available node is not a parent of the specified // node create a new node under the specified parent and set that // as the node of the specified element. - if (!node.getParent().equals(withParentNode)) { + if (!withParentNode.equals(node.getParent())) { node = nodeId != null ? withParentNode.getOrCreateNode(nodeId, nodeClass) : withParentNode.addNode(nodeClass); forElement.setHint(withNodeKey, node); if (nodeCreationCallback != null) -- 2.43.2