1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00

xmllint: Fix --insert option

Make sure that parent is an element when calling
xmlValidGetValidElements.
This commit is contained in:
Nick Wellnhofer 2024-05-06 00:29:07 +02:00
parent 20a0de95b4
commit 826baf00d4

View File

@ -2492,7 +2492,10 @@ static void parseAndPrintFile(const char *filename, xmlParserCtxtPtr rectxt) {
if (doc->children != NULL) {
node = doc->children;
while ((node != NULL) && (node->last == NULL)) node = node->next;
while ((node != NULL) &&
((node->type != XML_ELEMENT_NODE) ||
(node->last == NULL)))
node = node->next;
if (node != NULL) {
nb = xmlValidGetValidElements(node->last, NULL, list, 256);
if (nb < 0) {