blob: 22d206a5d1343aefeb0f3146abca4c0cf86af19f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
From: Daniel Veillard <veillard@redhat.com>
Date: Sat, 8 Feb 2014 02:22:35 +0800
Subject: Fix xmlTextWriterWriteElement when a null content is given
---
xmlwriter.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/xmlwriter.c b/xmlwriter.c
index d3f29f8..27209b9 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -2238,10 +2238,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;
|