diff --git a/ChangeLog b/ChangeLog index 9e170836..2b34f70f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 8 20:48:29 CEST 2000 Daniel Veillard + + * entities.c: cases where looking up entities with doc==NULL + covered + Tue Sep 5 12:41:15 CEST 2000 Daniel Veillard * uri.c: applied Wayne Davison patch diff --git a/entities.c b/entities.c index 1f960551..63ebda7d 100644 --- a/entities.c +++ b/entities.c @@ -590,6 +590,8 @@ xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) { xmlEntitiesTablePtr table; xmlEntityPtr ret; + if (doc == NULL) + return(NULL); if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { table = (xmlEntitiesTablePtr) doc->intSubset->entities; ret = xmlGetEntityFromTable(table, name, 1); @@ -617,6 +619,8 @@ xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { xmlEntitiesTablePtr table; + if (doc == NULL) + return(NULL); if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { table = (xmlEntitiesTablePtr) doc->extSubset->entities; return(xmlGetEntityFromTable(table, name, 0)); @@ -640,17 +644,19 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { xmlEntityPtr cur; xmlEntitiesTablePtr table; - if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->intSubset->entities; - cur = xmlGetEntityFromTable(table, name, 0); - if (cur != NULL) - return(cur); - } - if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->extSubset->entities; - cur = xmlGetEntityFromTable(table, name, 0); - if (cur != NULL) - return(cur); + if (doc != NULL) { + if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->intSubset->entities; + cur = xmlGetEntityFromTable(table, name, 0); + if (cur != NULL) + return(cur); + } + if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; + cur = xmlGetEntityFromTable(table, name, 0); + if (cur != NULL) + return(cur); + } } if (xmlPredefinedEntities == NULL) xmlInitializePredefinedEntities();