groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Fix a potential NPE introduced when extracting common variable
Date Wed, 09 May 2018 10:50:39 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 5d42668e3 -> 9b0949a1b


Fix a potential NPE introduced when extracting common variable

(cherry picked from commit 2e31936)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9b0949a1
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9b0949a1
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9b0949a1

Branch: refs/heads/GROOVY_2_6_X
Commit: 9b0949a1b29012d9612edd384a2da0b31e1d4c0d
Parents: 5d42668
Author: sunlan <sunlan@apache.org>
Authored: Wed May 9 18:49:50 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed May 9 18:50:31 2018 +0800

----------------------------------------------------------------------
 .../org/codehaus/groovy/macro/methods/MacroGroovyMethods.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/9b0949a1/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/methods/MacroGroovyMethods.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/methods/MacroGroovyMethods.java
b/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/methods/MacroGroovyMethods.java
index 2a14a30..6a8480e 100644
--- a/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/methods/MacroGroovyMethods.java
+++ b/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/methods/MacroGroovyMethods.java
@@ -195,8 +195,8 @@ public class MacroGroovyMethods {
     protected static ClosureExpression getClosureArgument(SourceUnit source, MethodCallExpression
call) {
         TupleExpression tupleArguments = getMacroArguments(source, call);
 
-        int size = tupleArguments.getExpressions().size();
-        if (tupleArguments == null || size < 1) {
+        int size = tupleArguments == null ? -1 : tupleArguments.getExpressions().size();
+        if (size < 1) {
             source.addError(new SyntaxException("Call arguments should have at least one
argument" + '\n', tupleArguments));
             return null;
         }


Mime
View raw message