[libxml2] Report undefined XPath variable error message



commit 3157cf4e53c03bc3da604472c015c63141907db8
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Sep 20 16:13:29 2017 +0200

    Report undefined XPath variable error message
    
    Commit c851970 removed a redundant error message if XPath evaluation
    failed. This uncovered a case where an undefined XPath variable error
    wasn't reported correctly.
    
    Thanks to Petr Pisar for the report.
    
    Fixes bug 787941.

 xpath.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index 2c1b268..9481507 100644
--- a/xpath.c
+++ b/xpath.c
@@ -13531,10 +13531,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
                 if (op->value5 == NULL) {
                    val = xmlXPathVariableLookup(ctxt->context, op->value4);
-                   if (val == NULL) {
-                       ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
-                       return(0);
-                   }
+                   if (val == NULL)
+                       XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR);
                     valuePush(ctxt, val);
                } else {
                     const xmlChar *URI;
@@ -13549,10 +13547,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                     }
                    val = xmlXPathVariableLookupNS(ctxt->context,
                                                        op->value4, URI);
-                   if (val == NULL) {
-                       ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
-                       return(0);
-                   }
+                   if (val == NULL)
+                       XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR);
                     valuePush(ctxt, val);
                 }
                 return (total);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]