data tree BUGFIX do not require ctx for new meta
diff --git a/src/tree_data.c b/src/tree_data.c
index 2368f30..0b70249 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1020,7 +1020,10 @@
     const char *prefix, *tmp;
     size_t pref_len, name_len;
 
-    LY_CHECK_ARG_RET(NULL, ctx, name, module || strchr(name, ':'), parent || meta, LY_EINVAL);
+    LY_CHECK_ARG_RET(ctx, ctx || parent, name, module || strchr(name, ':'), parent || meta, LY_EINVAL);
+    if (!ctx) {
+        ctx = LYD_CTX(parent);
+    }
 
     if (parent && !parent->schema) {
         LOGERR(ctx, LY_EINVAL, "Cannot add metadata to an opaque node \"%s\".", ((struct lyd_node_opaq *)parent)->name);