1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-07 06:43:02 +03:00

Fixed cases where doc is NULL when looking up entities, daniel

This commit is contained in:
Daniel Veillard
2000-09-08 18:54:41 +00:00
parent 1de5080002
commit 4b5b80cf02
2 changed files with 22 additions and 11 deletions

View File

@@ -1,3 +1,8 @@
Fri Sep 8 20:48:29 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* entities.c: cases where looking up entities with doc==NULL
covered
Tue Sep 5 12:41:15 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> Tue Sep 5 12:41:15 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* uri.c: applied Wayne Davison patch * uri.c: applied Wayne Davison patch

View File

@@ -590,6 +590,8 @@ xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) {
xmlEntitiesTablePtr table; xmlEntitiesTablePtr table;
xmlEntityPtr ret; xmlEntityPtr ret;
if (doc == NULL)
return(NULL);
if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
table = (xmlEntitiesTablePtr) doc->intSubset->entities; table = (xmlEntitiesTablePtr) doc->intSubset->entities;
ret = xmlGetEntityFromTable(table, name, 1); ret = xmlGetEntityFromTable(table, name, 1);
@@ -617,6 +619,8 @@ xmlEntityPtr
xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) {
xmlEntitiesTablePtr table; xmlEntitiesTablePtr table;
if (doc == NULL)
return(NULL);
if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
table = (xmlEntitiesTablePtr) doc->extSubset->entities; table = (xmlEntitiesTablePtr) doc->extSubset->entities;
return(xmlGetEntityFromTable(table, name, 0)); return(xmlGetEntityFromTable(table, name, 0));
@@ -640,17 +644,19 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
xmlEntityPtr cur; xmlEntityPtr cur;
xmlEntitiesTablePtr table; xmlEntitiesTablePtr table;
if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { if (doc != NULL) {
table = (xmlEntitiesTablePtr) doc->intSubset->entities; if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
cur = xmlGetEntityFromTable(table, name, 0); table = (xmlEntitiesTablePtr) doc->intSubset->entities;
if (cur != NULL) cur = xmlGetEntityFromTable(table, name, 0);
return(cur); if (cur != NULL)
} return(cur);
if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { }
table = (xmlEntitiesTablePtr) doc->extSubset->entities; if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
cur = xmlGetEntityFromTable(table, name, 0); table = (xmlEntitiesTablePtr) doc->extSubset->entities;
if (cur != NULL) cur = xmlGetEntityFromTable(table, name, 0);
return(cur); if (cur != NULL)
return(cur);
}
} }
if (xmlPredefinedEntities == NULL) if (xmlPredefinedEntities == NULL)
xmlInitializePredefinedEntities(); xmlInitializePredefinedEntities();