fixed 2 bugs pointed in #116448 Daniel

* debugXML.c xpath.c: fixed 2 bugs pointed in #116448
Daniel
diff --git a/debugXML.c b/debugXML.c
index 8d2f8e7..6109711 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -2104,7 +2104,7 @@
     while (1) {
         if (ctxt->node == (xmlNodePtr) ctxt->doc)
             snprintf(prompt, sizeof(prompt), "%s > ", "/");
-        else if (ctxt->node->name)
+        else if ((ctxt->node != NULL) && (ctxt->node->name))
             snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
         else
             snprintf(prompt, sizeof(prompt), "? > ");
@@ -2329,6 +2329,13 @@
                             if (list->nodesetval != NULL) {
 				if (list->nodesetval->nodeNr == 1) {
 				    ctxt->node = list->nodesetval->nodeTab[0];
+				    if ((ctxt->node != NULL) &&
+				        (ctxt->node->type ==
+					 XML_NAMESPACE_DECL)) {
+					xmlGenericError(xmlGenericErrorContext,
+						    "cannot cd to namespace\n");
+					ctxt->node = NULL;
+				    }
 				} else
 				    xmlGenericError(xmlGenericErrorContext,
 						    "%s is a %d Node Set\n",