Skip to content

Commit 07e8fc6

Browse files
committed
printer json BUGFIX avoid invalid argument error
1 parent 8ff1da5 commit 07e8fc6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/printer_json.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static void
157157
node_prefix(const struct lyd_node *node, const struct lysc_node *snode, const char **mod_name, ly_bool *data_dict)
158158
{
159159
struct lyd_node_opaq *onode;
160-
const struct lys_module *mod;
160+
const struct lys_module *mod = NULL;
161161

162162
*mod_name = NULL;
163163

@@ -177,7 +177,9 @@ node_prefix(const struct lyd_node *node, const struct lysc_node *snode, const ch
177177
}
178178
break;
179179
case LY_VALUE_XML:
180-
mod = ly_ctx_get_module_implemented_ns(onode->ctx, onode->name.module_ns);
180+
if (onode->name.module_ns) {
181+
mod = ly_ctx_get_module_implemented_ns(onode->ctx, onode->name.module_ns);
182+
}
181183
if (mod) {
182184
*mod_name = mod->name;
183185
if (data_dict) {

0 commit comments

Comments
 (0)