[libxml2] Fix xmlTextWriterWriteElement when a null content is given



commit c9ecf45d1bf4ed9bdfed7f9733687a4df1daf897
Author: Daniel Veillard <veillard redhat com>
Date:   Sat Feb 8 02:22:35 2014 +0800

    Fix xmlTextWriterWriteElement when a null content is given

 xmlwriter.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/xmlwriter.c b/xmlwriter.c
index 2e21d1b..fac20ac 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -2242,10 +2242,12 @@ xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
     if (count == -1)
         return -1;
     sum += count;
-    count = xmlTextWriterWriteString(writer, content);
-    if (count == -1)
-        return -1;
-    sum += count;
+    if (content != NULL) {
+       count = xmlTextWriterWriteString(writer, content);
+       if (count == -1)
+           return -1;
+       sum += count;
+    }
     count = xmlTextWriterEndElement(writer);
     if (count == -1)
         return -1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]