summaryrefslogtreecommitdiff
path: root/libxslt
diff options
context:
space:
mode:
Diffstat (limited to 'libxslt')
-rw-r--r--libxslt/functions.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libxslt/functions.c b/libxslt/functions.c
index 7ab139eb..2452722e 100644
--- a/libxslt/functions.c
+++ b/libxslt/functions.c
@@ -249,7 +249,7 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
obj = valuePop(ctxt);
ret = xmlXPathNewNodeSet(NULL);
- if ((obj != NULL) && obj->nodesetval) {
+ if ((obj != NULL) && (obj->nodesetval != NULL) && (ret != NULL)) {
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
valuePush(ctxt,
xmlXPathNewNodeSet(obj->nodesetval->nodeTab[i]));
@@ -263,9 +263,11 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
}
xsltDocumentFunction(ctxt, 2);
newobj = valuePop(ctxt);
- ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval,
- newobj->nodesetval);
- xmlXPathFreeObject(newobj);
+ if (newobj != NULL) {
+ ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval,
+ newobj->nodesetval);
+ xmlXPathFreeObject(newobj);
+ }
}
}