Skip to content

Commit

Permalink
yin parser BUGFIX accept empty strings in text/value elements of desc…
Browse files Browse the repository at this point in the history
…ription, reference, etc.

Fixes #20
  • Loading branch information
rkrejci committed Feb 10, 2016
1 parent 8c75362 commit 1eb39c9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/parser_yin.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ read_yin_subnode(struct ly_ctx *ctx, struct lyxml_elem *node, const char *name)

/* there should be <text> child */
if (!node->child || !node->child->name || strcmp(node->child->name, name)) {
LOGWRN("Expected \"%s\" element in \"%s\" element.", name, node->name);
LOGERR(LY_EVALID, "Expected \"%s\" element in \"%s\" element.", name, node->name);
LOGVAL(LYE_INARG, LOGLINE(node), name, node->name);
return NULL;
} else if (node->child->content) {
len = strlen(node->child->content);
return lydict_insert(ctx, node->child->content, len);
} else {
return lydict_insert(ctx, "", 0);
}

LOGVAL(LYE_INARG, LOGLINE(node), name, node->name);
return NULL;
}

/* logs directly */
Expand Down

0 comments on commit 1eb39c9

Please sign in to comment.