1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-28 00:21:53 +03:00

Heiko Rupp pointed that the shell would crash on empty nodesets returns.

* debugXML.c: Heiko Rupp pointed that the shell would crash
  on empty nodesets returns.
Daniel
This commit is contained in:
Daniel Veillard
2001-11-07 13:33:59 +00:00
parent 03f848d886
commit a6825e8df8
2 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Wed Nov 7 14:32:55 CET 2001 Daniel Veillard <daniel@veillard.com>
* debugXML.c: Heiko Rupp pointed that the shell would crash
on empty nodesets returns.
Wed Nov 7 13:52:36 CET 2001 Daniel Veillard <daniel@veillard.com> Wed Nov 7 13:52:36 CET 2001 Daniel Veillard <daniel@veillard.com>
* Makefile.am: Weiqi Gao pointed out that xmlcatalog * Makefile.am: Weiqi Gao pointed out that xmlcatalog

View File

@ -2038,6 +2038,9 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
case XPATH_NODESET:{ case XPATH_NODESET:{
int indx; int indx;
if (list->nodesetval == NULL)
break;
for (indx = 0; for (indx = 0;
indx < list->nodesetval->nodeNr; indx < list->nodesetval->nodeNr;
indx++) { indx++) {
@ -2112,13 +2115,18 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
"%s: no such node\n", arg); "%s: no such node\n", arg);
break; break;
case XPATH_NODESET: case XPATH_NODESET:
if (list->nodesetval->nodeNr == 1) { if (list->nodesetval != NULL) {
ctxt->node = list->nodesetval->nodeTab[0]; if (list->nodesetval->nodeNr == 1) {
ctxt->node = list->nodesetval->nodeTab[0];
} else
xmlGenericError(xmlGenericErrorContext,
"%s is a %d Node Set\n",
arg,
list->nodesetval->nodeNr);
} else } else
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"%s is a %d Node Set\n", "%s is an empty Node Set\n",
arg, arg);
list->nodesetval->nodeNr);
break; break;
case XPATH_BOOLEAN: case XPATH_BOOLEAN:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
@ -2183,6 +2191,9 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
case XPATH_NODESET:{ case XPATH_NODESET:{
int indx; int indx;
if (list->nodesetval == NULL)
break;
for (indx = 0; for (indx = 0;
indx < list->nodesetval->nodeNr; indx < list->nodesetval->nodeNr;
indx++) { indx++) {