Skip to content

Commit

Permalink
Change: Restrict element_first_child and element_next to element nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier authored May 15, 2023
2 parents 1b38b8d + 8e220cf commit 86d776e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions util/xmlutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,12 @@ element_t
element_first_child (element_t element)
{
if (element)
return element->children;
{
element = element->children;
while (element && (element->type != XML_ELEMENT_NODE))
element = element->next;
return element;
}
return NULL;
}

Expand All @@ -2046,7 +2051,12 @@ element_t
element_next (element_t element)
{
if (element)
return element->next;
{
element = element->next;
while (element && (element->type != XML_ELEMENT_NODE))
element = element->next;
return element;
}
return NULL;
}

Expand Down

0 comments on commit 86d776e

Please sign in to comment.