summaryrefslogtreecommitdiff
path: root/HTMLtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'HTMLtree.c')
-rw-r--r--HTMLtree.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/HTMLtree.c b/HTMLtree.c
index 9a5d35f..f3f2aae 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -522,6 +522,8 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
xmlInitParser();
+ if ((mem == NULL) || (size == NULL))
+ return;
if (cur == NULL) {
*mem = NULL;
*size = 0;
@@ -745,7 +747,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
xmlInitParser();
- if (cur == NULL) {
+ if ((cur == NULL) || (buf == NULL)) {
return;
}
/*
@@ -753,7 +755,8 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
*/
if (cur->type == XML_DTD_NODE)
return;
- if (cur->type == XML_HTML_DOCUMENT_NODE) {
+ if ((cur->type == XML_HTML_DOCUMENT_NODE) ||
+ (cur->type == XML_DOCUMENT_NODE)){
htmlDocContentDumpOutput(buf, (xmlDocPtr) cur, encoding);
return;
}
@@ -944,6 +947,9 @@ htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
xmlInitParser();
+ if ((buf == NULL) || (cur == NULL))
+ return;
+
/*
* force to output the stuff as HTML, especially for entities
*/
@@ -997,7 +1003,7 @@ htmlDocDump(FILE *f, xmlDocPtr cur) {
xmlInitParser();
- if (cur == NULL) {
+ if ((cur == NULL) || (f == NULL)) {
return(-1);
}
@@ -1053,6 +1059,9 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
const char *encoding;
int ret;
+ if ((cur == NULL) || (filename == NULL))
+ return(-1);
+
xmlInitParser();
encoding = (const char *) htmlGetMetaEncoding(cur);
@@ -1113,6 +1122,9 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
xmlCharEncodingHandlerPtr handler = NULL;
int ret;
+ if ((cur == NULL) || (filename == NULL))
+ return(-1);
+
xmlInitParser();
if (encoding != NULL) {