1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-11 21:41: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

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