fixed problem with empty sets, etc. (see discussion on mailing list)
authorWilliam M. Brack <wbrack@src.gnome.org>
Fri, 24 Sep 2004 16:15:16 +0000 (16:15 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Fri, 24 Sep 2004 16:15:16 +0000 (16:15 +0000)
* libexslt/date.c: fixed problem with empty sets, etc.
  (see discussion on mailing list)

ChangeLog
libexslt/date.c

index e6d5e07..abb28ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 24 09:17:22 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+       * libexslt/date.c: fixed problem with empty sets, etc.
+         (see discussion on mailing list)
+
 Sat Sep 18 17:08:31 PDT 2004 William Brack <wbrack@mmm.com.hk>
 
        * libexslt/date.c: fixed problem with timezone offset
index 3cf8160..0d3445c 100644 (file)
@@ -2748,20 +2748,28 @@ exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs)
     if (xmlXPathCheckError (ctxt))
        return;
 
-    if ((ns == NULL) || (ns->nodeNr == 0))
+    if ((ns == NULL) || (ns->nodeNr == 0)) {
+       xmlXPathReturnEmptyString (ctxt);
        return;
+    }
 
     total = exsltDateCreateDate (XS_DURATION);
+    if (total == NULL)
+        return;
 
     for (i = 0; i < ns->nodeNr; i++) {
 
        tmp = xmlXPathCastNodeToString (ns->nodeTab[i]);
-       if (tmp == NULL)
+       if (tmp == NULL) {
+           exsltDateFreeDate (total);
            return;
+       }
 
        x = exsltDateParseDuration (tmp);
        if (x == NULL) {
            xmlFree (tmp);
+           exsltDateFreeDate (total);
+           xmlXPathReturnEmptyString (ctxt);
            return;
        }