]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Prevent NPE when comparing a node that is still without parent. 42/342/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 3 Mar 2017 07:33:57 +0000 (09:33 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 3 Mar 2017 07:33:57 +0000 (09:33 +0200)
refs #7062

Change-Id: I13990a8db66408c1bc3cab6e4da8ba7997220c1a

bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementUtils.java

index 1a12210f0912c23ccc2fbd1ea01fcdcb246a4e4a..74934321739daa9dc59e20ffa0f02a96ab25b65f 100644 (file)
@@ -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)