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:
21
debugXML.c
21
debugXML.c
@ -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++) {
|
||||
|
Reference in New Issue
Block a user