corrected handling of empty fallback condition (bug 132585)
* xinclude.c: corrected handling of empty fallback condition
(bug 132585)
diff --git a/xinclude.c b/xinclude.c
index 607a8f8..62a0761 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -1773,20 +1773,24 @@
if ((fallback == NULL) || (ctxt == NULL))
return(-1);
- /*
- * It's possible that the fallback also has 'includes'
- * (Bug 129969), so we re-process the fallback just in case
- */
- newctxt = xmlXIncludeNewContext(ctxt->doc);
- if (newctxt == NULL)
- return (-1);
- xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
- ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children);
- if ((ret >=0) && (ctxt->nbErrors > 0))
- ret = -1;
- xmlXIncludeFreeContext(newctxt);
+ if (fallback->children != NULL) {
+ /*
+ * It's possible that the fallback also has 'includes'
+ * (Bug 129969), so we re-process the fallback just in case
+ */
+ newctxt = xmlXIncludeNewContext(ctxt->doc);
+ if (newctxt == NULL)
+ return (-1);
+ xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
+ ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children);
+ if ((ret >=0) && (ctxt->nbErrors > 0))
+ ret = -1;
+ xmlXIncludeFreeContext(newctxt);
- ctxt->incTab[nr]->inc = xmlCopyNodeList(fallback->children);
+ ctxt->incTab[nr]->inc = xmlCopyNodeList(fallback->children);
+ } else {
+ ctxt->incTab[nr]->inc = NULL;
+ }
return(ret);
}