This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git

commit c0240aa872f063c7175f892e77b8f13420a9b649
Author: Gary D. Gregory <[email protected]>
AuthorDate: Sun Mar 16 13:26:11 2025 -0400

    No need to nest else
---
 .../java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java    | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java 
b/src/main/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java
index c36a991..815bf6e 100644
--- a/src/main/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java
+++ b/src/main/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java
@@ -390,12 +390,10 @@ public class CoreFunction extends Operation {
         EvalContext ec = null;
         if (value instanceof EvalContext) {
             ec = (EvalContext) value;
-            if (ec.hasNext()) {
-                value = ((NodePointer) ec.next()).getValue();
-            }
-            else { // empty context -> empty results
+            if (!ec.hasNext()) { // empty context -> empty results
                 return new NodeSetContext(context, new BasicNodeSet());
             }
+            value = ((NodePointer) ec.next()).getValue();
         }
         final JXPathContext jxpathContext = context.getJXPathContext();
         NodeSet nodeSet = jxpathContext.getNodeSetByKey(key, value);

Reply via email to