From 3157cf4e53c03bc3da604472c015c63141907db8 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 20 Sep 2017 16:13:29 +0200 Subject: [PATCH] Report undefined XPath variable error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Petr Písař --- xpath.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xpath.c b/xpath.c index 2c1b2681..94815075 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); -- 2.13.5