Merge "Fixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)"
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AbstractModifiedNodeBasedCandidateNode.java
index daea495326fdf1ef20e38f1712a82de380ae4571..4788029b8a3d1cd3367f8c65b3f35fcbc7cf06dd 100644 (file)
@@ -59,6 +59,12 @@ abstract class AbstractModifiedNodeBasedCandidateNode implements DataTreeCandida
     }
 
     private static DataTreeCandidateNode createChildNode(@Nonnull final ModifiedNode input, @Nullable final TreeNode oldMeta, @Nullable final TreeNode newMeta) {
+        if(oldMeta == null) {
+            return RecursiveModificationCandidateNode.initialWriteNode(newMeta.getData());
+        }
+        if(newMeta == null) {
+            return RecursiveModificationCandidateNode.deleteNode(oldMeta.getData());
+        }
         return new ChildNode(input, oldMeta, newMeta);
     }