tree data BUGFIX validating NULL values
diff --git a/src/tree_data_common.c b/src/tree_data_common.c
index f6a53c9..e023c54 100644
--- a/src/tree_data_common.c
+++ b/src/tree_data_common.c
@@ -495,12 +495,15 @@
     struct lyd_value val = {0};
     ly_bool stored = 0, log = 1;
 
-    LY_CHECK_ARG_RET(ctx, schema, value, LY_EINVAL);
+    LY_CHECK_ARG_RET(ctx, schema, !value_len || value, LY_EINVAL);
 
     if (!ctx) {
         ctx = schema->module->ctx;
         log = 0;
     }
+    if (!value_len) {
+        value = "";
+    }
     type = ((struct lysc_node_leaf *)schema)->type;
 
     /* store */